diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-02-16 10:47:32 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-02-16 10:47:32 -0800 |
| commit | 38efc6f5727046a38e8e1903f7fb715362926b7e (patch) | |
| tree | 1e58b90528baba9ee514bf1af3db6a169b8746b7 | |
| parent | ad70107eb4285f2d42ec011de7060b50ad1829b4 (diff) | |
| download | seaweedfs-38efc6f5727046a38e8e1903f7fb715362926b7e.tar.xz seaweedfs-38efc6f5727046a38e8e1903f7fb715362926b7e.zip | |
simplify
| -rw-r--r-- | weed/shell/command_volume_server_evacuate.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/shell/command_volume_server_evacuate.go b/weed/shell/command_volume_server_evacuate.go index 8acc943cf..5216de66b 100644 --- a/weed/shell/command_volume_server_evacuate.go +++ b/weed/shell/command_volume_server_evacuate.go @@ -179,8 +179,9 @@ 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) { + fn := capacityByFreeVolumeCount(types.ToDiskType(vol.DiskType)) sort.Slice(otherNodes, func(i, j int) bool { - return otherNodes[i].localVolumeRatio(capacityByFreeVolumeCount(types.ToDiskType(vol.DiskType))) > otherNodes[j].localVolumeRatio(capacityByFreeVolumeCount(types.ToDiskType(vol.DiskType))) + return otherNodes[i].localVolumeRatio(fn) > otherNodes[j].localVolumeRatio(fn) }) for i := 0; i < len(otherNodes); i++ { |
