Browse Source

fs.conf 反序列化问题修复

Signed-off-by: changlin.shi <changlin.shi@ly.com>
pull/5936/head
changlin.shi 1 year ago
parent
commit
682f24a9ac
  1. 7
      weed/filer/filer_conf.go
  2. 8
      weed/shell/command_fs_configure.go

7
weed/filer/filer_conf.go

@ -92,8 +92,11 @@ func (fc *FilerConf) loadFromChunks(filer *Filer, content []byte, chunks []*file
func (fc *FilerConf) LoadFromBytes(data []byte) (err error) {
conf := &filer_pb.FilerConf{}
if err := jsonpb.Unmarshal(data, conf); err != nil {
options := &jsonpb.UnmarshalOptions{
DiscardUnknown: true,
AllowPartial: true,
}
if err := options.Unmarshal(data, conf); err != nil {
return err
}

8
weed/shell/command_fs_configure.go

@ -5,7 +5,6 @@ import (
"flag"
"fmt"
"io"
"strings"
"github.com/seaweedfs/seaweedfs/weed/filer"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
@ -51,7 +50,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io
locationPrefix := fsConfigureCommand.String("locationPrefix", "", "path prefix, required to update the path-specific configuration")
collection := fsConfigureCommand.String("collection", "", "assign writes to this collection")
replication := fsConfigureCommand.String("replication", "", "assign writes with this replication")
ttl := fsConfigureCommand.String("ttl", "", "assign writes with this ttl")
ttl := fsConfigureCommand.String("ttl", "", "assign writes with this ttl (e.g., 1m, 1h, 1d, 1w, 1y)")
diskType := fsConfigureCommand.String("disk", "", "[hdd|ssd|<tag>] hard drive or solid state drive or any tag")
fsync := fsConfigureCommand.Bool("fsync", false, "fsync for the writes")
isReadOnly := fsConfigureCommand.Bool("readOnly", false, "disable writes")
@ -86,11 +85,6 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io
DataNode: *dataNode,
}
// check collection
if *collection != "" && strings.HasPrefix(*locationPrefix, "/buckets/") {
return fmt.Errorf("one s3 bucket goes to one collection and not customizable")
}
// check replication
if *replication != "" {
rp, err := super_block.NewReplicaPlacementFromString(*replication)

Loading…
Cancel
Save