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
fix volume placement validating
Chris Lu7385103057ab
diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.goindex 53222ca29f..928dec02a8 100644--- a/weed/shell/command_volume_balance.go+++ b/weed/shell/command_volume_balance.go@@ -306,16 +306,16 @@ func isGoodMove(placement *super_block.ReplicaPlacement, existingReplicas []*Voldcs[targetNode.dc] = trueracks[fmt.Sprintf("%s %s", targetNode.dc, targetNode.rack)]++- if len(dcs) > placement.DiffDataCenterCount+1 {+ if len(dcs) != placement.DiffDataCenterCount+1 {return false}- if len(racks) > placement.DiffRackCount+placement.DiffDataCenterCount+1 {+ if len(racks) != placement.DiffRackCount+placement.DiffDataCenterCount+1 {return false}for _, sameRackCount := range racks {- if sameRackCount > placement.SameRackCount+1 {+ if sameRackCount != placement.SameRackCount+1 {return false}}diff --git a/weed/shell/command_volume_balance_test.go b/weed/shell/command_volume_balance_test.goindex 9e154dc00e..696bc7fac4 100644--- a/weed/shell/command_volume_balance_test.go+++ b/weed/shell/command_volume_balance_test.go@@ -20,6 +20,22 @@ func TestIsGoodMove(t *testing.T) {var tests = []testMoveCase{+ {+ name: "test 100 move to wrong data centers",+ replication: "100",+ replicas: []*VolumeReplica{+ {+ location: &location{"dc1", "r1", &master_pb.DataNodeInfo{Id: "dn1"}},+ },+ {+ location: &location{"dc2", "r2", &master_pb.DataNodeInfo{Id: "dn2"}},+ },+ },+ sourceLocation: location{"dc1", "r1", &master_pb.DataNodeInfo{Id: "dn1"}},+ targetLocation: location{"dc2", "r3", &master_pb.DataNodeInfo{Id: "dn3"}},+ expected: false,+ },+{name: "test 100 move to spread into proper data centers",replication: "100",