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
refactor
chrislu049f040c3c6b
diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.goindex 980a8d7d1a..e138575367 100644--- a/weed/shell/command_volume_balance.go+++ b/weed/shell/command_volume_balance.go@@ -4,6 +4,7 @@ import ("flag""fmt""github.com/seaweedfs/seaweedfs/weed/pb"+ "github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding""github.com/seaweedfs/seaweedfs/weed/storage/super_block""github.com/seaweedfs/seaweedfs/weed/storage/types""golang.org/x/exp/slices"@@ -132,7 +133,7 @@ func balanceVolumeServersByDiskType(commandEnv *CommandEnv, diskType types.DiskTreturn v.DiskType == string(diskType)})}- if err := balanceSelectedVolume(commandEnv, diskType, volumeReplicas, nodes, capacityByMaxVolumeCount(diskType), sortWritableVolumes, applyBalancing); err != nil {+ if err := balanceSelectedVolume(commandEnv, diskType, volumeReplicas, nodes, sortWritableVolumes, applyBalancing); err != nil {return err}@@ -242,9 +243,10 @@ func sortWritableVolumes(volumes []*master_pb.VolumeInformationMessage) {})}-func balanceSelectedVolume(commandEnv *CommandEnv, diskType types.DiskType, volumeReplicas map[uint32][]*VolumeReplica, nodes []*Node, capacityFunc CapacityFunc, sortCandidatesFn func(volumes []*master_pb.VolumeInformationMessage), applyBalancing bool) (err error) {+func balanceSelectedVolume(commandEnv *CommandEnv, diskType types.DiskType, volumeReplicas map[uint32][]*VolumeReplica, nodes []*Node, sortCandidatesFn func(volumes []*master_pb.VolumeInformationMessage), applyBalancing bool) (err error) {selectedVolumeCount, volumeMaxCount := 0, float64(0)var nodesWithCapacity []*Node+ capacityFunc := capacityByMaxVolumeCount(diskType)for _, dn := range nodes {selectedVolumeCount += len(dn.selectedVolumes)capacity := capacityFunc(dn.info)