diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2021-10-27 09:42:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-27 09:42:23 +0800 |
| commit | 6999325d3631f0e9f4fe4e081650dcf60a1293c5 (patch) | |
| tree | 99082f145eeee921ae772d0c8601f97f40b7f074 /weed/shell/command_ec_decode.go | |
| parent | ee90edd0e3746ae0f6046dd9e7362aeec821456c (diff) | |
| parent | 3eeaffeadd9bcff0148d0b1c860ea4ff03e82904 (diff) | |
| download | seaweedfs-6999325d3631f0e9f4fe4e081650dcf60a1293c5.tar.xz seaweedfs-6999325d3631f0e9f4fe4e081650dcf60a1293c5.zip | |
Merge pull request #84 from chrislusf/master
sync
Diffstat (limited to 'weed/shell/command_ec_decode.go')
| -rw-r--r-- | weed/shell/command_ec_decode.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/weed/shell/command_ec_decode.go b/weed/shell/command_ec_decode.go index cfa24cc31..c9f49745b 100644 --- a/weed/shell/command_ec_decode.go +++ b/weed/shell/command_ec_decode.go @@ -4,6 +4,7 @@ import ( "context" "flag" "fmt" + "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/storage/types" "io" @@ -40,6 +41,7 @@ func (c *commandEcDecode) Do(args []string, commandEnv *CommandEnv, writer io.Wr encodeCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError) volumeId := encodeCommand.Int("volumeId", 0, "the volume id") collection := encodeCommand.String("collection", "", "the collection name") + forceChanges := encodeCommand.Bool("force", false, "force the encoding even if the cluster has less than recommended 4 nodes") if err = encodeCommand.Parse(args); err != nil { return nil } @@ -56,6 +58,17 @@ func (c *commandEcDecode) Do(args []string, commandEnv *CommandEnv, writer io.Wr return err } + if !*forceChanges { + var nodeCount int + eachDataNode(topologyInfo, func(dc string, rack RackId, dn *master_pb.DataNodeInfo) { + nodeCount++ + }) + if nodeCount < erasure_coding.ParityShardsCount { + glog.V(0).Infof("skip erasure coding with %d nodes, less than recommended %d nodes", nodeCount, erasure_coding.ParityShardsCount) + return nil + } + } + // volumeId is provided if vid != 0 { return doEcDecode(commandEnv, topologyInfo, *collection, vid) |
