aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_balance.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-07-01 12:16:18 -0700
committerchrislu <chris.lu@gmail.com>2022-07-01 12:16:18 -0700
commit141f662734b56ac08f96ebd28552a8002002c124 (patch)
tree04b5e4d2b9cd9f9302084367a3c1bd6e4098f05a /weed/shell/command_volume_balance.go
parentbee3a7c7987ecd23450febcc37651312ddf4fffa (diff)
downloadseaweedfs-141f662734b56ac08f96ebd28552a8002002c124.tar.xz
seaweedfs-141f662734b56ac08f96ebd28552a8002002c124.zip
edge case checking when volume server does not have capacity to balance
fix https://github.com/chrislusf/seaweedfs/issues/3257
Diffstat (limited to 'weed/shell/command_volume_balance.go')
-rw-r--r--weed/shell/command_volume_balance.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go
index 462143e25..8619ad99e 100644
--- a/weed/shell/command_volume_balance.go
+++ b/weed/shell/command_volume_balance.go
@@ -259,6 +259,10 @@ func balanceSelectedVolume(commandEnv *CommandEnv, diskType types.DiskType, volu
slices.SortFunc(nodesWithCapacity, func(a, b *Node) bool {
return a.localVolumeRatio(capacityFunc) < b.localVolumeRatio(capacityFunc)
})
+ if len(nodesWithCapacity) == 0 {
+ fmt.Printf("no volume server found with capacity for %s", diskType.ReadableString())
+ return nil
+ }
fullNode := nodesWithCapacity[len(nodesWithCapacity)-1]
var candidateVolumes []*master_pb.VolumeInformationMessage
for _, v := range fullNode.selectedVolumes {