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
Improve EC shards balancing logic regarding replica placement settings. (#6491)
Lisandro Pin331c1f0f3f1a
diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.goindex f1d7012d85..0affc7365d 100644--- a/weed/shell/command_ec_common.go+++ b/weed/shell/command_ec_common.go@@ -783,8 +783,8 @@ func (ecb *ecBalancer) pickRackToBalanceShardsInto(rackToEcNodes map[RackId]*EcRdetails += fmt.Sprintf(" Skipped %s because it has no free slots\n", rackId)continue}- if ecb.replicaPlacement != nil && shards >= ecb.replicaPlacement.DiffRackCount {- details += fmt.Sprintf(" Skipped %s because shards %d >= replica placement limit for other racks (%d)\n", rackId, shards, ecb.replicaPlacement.DiffRackCount)+ if ecb.replicaPlacement != nil && shards > ecb.replicaPlacement.DiffRackCount {+ details += fmt.Sprintf(" Skipped %s because shards %d > replica placement limit for other racks (%d)\n", rackId, shards, ecb.replicaPlacement.DiffRackCount)continue}@@ -977,8 +977,8 @@ func (ecb *ecBalancer) pickEcNodeToBalanceShardsInto(vid needle.VolumeId, existi}shards := nodeShards[node]- if ecb.replicaPlacement != nil && shards >= ecb.replicaPlacement.SameRackCount {- details += fmt.Sprintf(" Skipped %s because shards %d >= replica placement limit for the rack (%d)\n", node.info.Id, shards, ecb.replicaPlacement.SameRackCount)+ if ecb.replicaPlacement != nil && shards > ecb.replicaPlacement.SameRackCount {+ details += fmt.Sprintf(" Skipped %s because shards %d > replica placement limit for the rack (%d)\n", node.info.Id, shards, ecb.replicaPlacement.SameRackCount)continue}diff --git a/weed/shell/command_ec_common_test.go b/weed/shell/command_ec_common_test.goindex f76840f3c1..87cf371d7f 100644--- a/weed/shell/command_ec_common_test.go+++ b/weed/shell/command_ec_common_test.go@@ -138,8 +138,8 @@ func TestPickRackToBalanceShardsInto(t *testing.T) {{topologyEc, "6241", "123", []string{"rack1", "rack2", "rack3", "rack4", "rack5", "rack6"}, ""},{topologyEc, "6242", "123", []string{"rack1", "rack2", "rack3", "rack4", "rack5", "rack6"}, ""},// EC volumes.- {topologyEc, "9577", "", nil, "shards 1 >= replica placement limit for other racks (0)"},- {topologyEc, "9577", "111", nil, "shards 1 >= replica placement limit for other racks (1)"},+ {topologyEc, "9577", "", nil, "shards 1 > replica placement limit for other racks (0)"},+ {topologyEc, "9577", "111", []string{"rack1", "rack2", "rack3"}, ""},{topologyEc, "9577", "222", []string{"rack1", "rack2", "rack3"}, ""},{topologyEc, "10457", "222", []string{"rack1"}, ""},{topologyEc, "12737", "222", []string{"rack2"}, ""},