mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add node.selectedVolumes
fix https://github.com/chrislusf/seaweedfs/issues/1990
This commit is contained in:
parent
16c0304416
commit
ba92f2e714
|
@ -176,6 +176,11 @@ func moveAwayOneEcVolume(commandEnv *CommandEnv, ecShardInfo *master_pb.VolumeEc
|
||||||
|
|
||||||
func moveAwayOneNormalVolume(commandEnv *CommandEnv, volumeReplicas map[uint32][]*VolumeReplica, vol *master_pb.VolumeInformationMessage, thisNode *Node, otherNodes []*Node, applyChange bool) (hasMoved bool, err error) {
|
func moveAwayOneNormalVolume(commandEnv *CommandEnv, volumeReplicas map[uint32][]*VolumeReplica, vol *master_pb.VolumeInformationMessage, thisNode *Node, otherNodes []*Node, applyChange bool) (hasMoved bool, err error) {
|
||||||
fn := capacityByFreeVolumeCount(types.ToDiskType(vol.DiskType))
|
fn := capacityByFreeVolumeCount(types.ToDiskType(vol.DiskType))
|
||||||
|
for _, n := range otherNodes {
|
||||||
|
n.selectVolumes(func(v *master_pb.VolumeInformationMessage) bool {
|
||||||
|
return v.DiskType == vol.DiskType
|
||||||
|
})
|
||||||
|
}
|
||||||
sort.Slice(otherNodes, func(i, j int) bool {
|
sort.Slice(otherNodes, func(i, j int) bool {
|
||||||
return otherNodes[i].localVolumeRatio(fn) > otherNodes[j].localVolumeRatio(fn)
|
return otherNodes[i].localVolumeRatio(fn) > otherNodes[j].localVolumeRatio(fn)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue