SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
default to skip if less than 4 nodes
chrislu0fd7222d65d5
diff --git a/weed/shell/command_ec_decode.go b/weed/shell/command_ec_decode.goindex 0aca9e00b1..aecc21065e 100644--- a/weed/shell/command_ec_decode.go+++ b/weed/shell/command_ec_decode.go@@ -4,7 +4,6 @@ import ("context""flag""fmt"- "github.com/seaweedfs/seaweedfs/weed/glog""github.com/seaweedfs/seaweedfs/weed/pb""github.com/seaweedfs/seaweedfs/weed/storage/types""io"@@ -39,14 +38,12 @@ func (c *commandEcDecode) Help() string {}func (c *commandEcDecode) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {- 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 {+ decodeCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)+ volumeId := decodeCommand.Int("volumeId", 0, "the volume id")+ collection := decodeCommand.String("collection", "", "the collection name")+ if err = decodeCommand.Parse(args); err != nil {return nil}- infoAboutSimulationMode(writer, *forceChanges, "-force")if err = commandEnv.confirmIsLocked(args); err != nil {return@@ -60,17 +57,6 @@ func (c *commandEcDecode) Do(args []string, commandEnv *CommandEnv, writer io.Wrreturn 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 providedif vid != 0 {return doEcDecode(commandEnv, topologyInfo, *collection, vid)diff --git a/weed/shell/command_ec_encode.go b/weed/shell/command_ec_encode.goindex 9fe7ad8e49..8864265a7c 100644--- a/weed/shell/command_ec_encode.go+++ b/weed/shell/command_ec_encode.go@@ -4,6 +4,7 @@ import ("context""flag""fmt"+ "github.com/seaweedfs/seaweedfs/weed/glog""github.com/seaweedfs/seaweedfs/weed/pb""io""math/rand"@@ -62,6 +63,7 @@ func (c *commandEcEncode) Do(args []string, commandEnv *CommandEnv, writer io.WrfullPercentage := encodeCommand.Float64("fullPercent", 95, "the volume reaches the percentage of max volume size")quietPeriod := encodeCommand.Duration("quietFor", time.Hour, "select volumes without no writes for this period")parallelCopy := encodeCommand.Bool("parallelCopy", true, "copy shards in parallel")+ 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}@@ -70,6 +72,23 @@ func (c *commandEcEncode) Do(args []string, commandEnv *CommandEnv, writer io.Wrreturn}+ // collect topology information+ topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)+ if err != nil {+ 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+ }+ }+vid := needle.VolumeId(*volumeId)// volumeId is provided