mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
edge case checking when volume server does not have capacity to balance
fix https://github.com/chrislusf/seaweedfs/issues/3257
This commit is contained in:
parent
bee3a7c798
commit
141f662734
|
@ -259,6 +259,10 @@ func balanceSelectedVolume(commandEnv *CommandEnv, diskType types.DiskType, volu
|
||||||
slices.SortFunc(nodesWithCapacity, func(a, b *Node) bool {
|
slices.SortFunc(nodesWithCapacity, func(a, b *Node) bool {
|
||||||
return a.localVolumeRatio(capacityFunc) < b.localVolumeRatio(capacityFunc)
|
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]
|
fullNode := nodesWithCapacity[len(nodesWithCapacity)-1]
|
||||||
var candidateVolumes []*master_pb.VolumeInformationMessage
|
var candidateVolumes []*master_pb.VolumeInformationMessage
|
||||||
for _, v := range fullNode.selectedVolumes {
|
for _, v := range fullNode.selectedVolumes {
|
||||||
|
|
Loading…
Reference in a new issue