From 682f24a9acc439fa613a0661ae6ea9331ab511c4 Mon Sep 17 00:00:00 2001 From: "changlin.shi" Date: Mon, 25 Dec 2023 11:39:28 +0800 Subject: [PATCH] =?UTF-8?q?fs.conf=20=E5=8F=8D=E5=BA=8F=E5=88=97=E5=8C=96?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changlin.shi --- weed/filer/filer_conf.go | 7 +++++-- weed/shell/command_fs_configure.go | 8 +------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/weed/filer/filer_conf.go b/weed/filer/filer_conf.go index ccb1acb3c..a4ab7f249 100644 --- a/weed/filer/filer_conf.go +++ b/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 } diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.go index 60edb79c2..901d7971e 100644 --- a/weed/shell/command_fs_configure.go +++ b/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|] 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)