diff options
| author | chrislu <chris.lu@gmail.com> | 2023-09-25 09:35:16 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2023-09-25 09:35:16 -0700 |
| commit | 645ae8c57bc449cbb298e90d1ad19f7d2153aea0 (patch) | |
| tree | 08458e352ea27e8e673a3670269ec84f04512d77 /weed/shell/command_volume_fix_replication.go | |
| parent | 3d07895518b2b6e816518be0a2355c1f0a98ff15 (diff) | |
| download | seaweedfs-645ae8c57bc449cbb298e90d1ad19f7d2153aea0.tar.xz seaweedfs-645ae8c57bc449cbb298e90d1ad19f7d2153aea0.zip | |
Revert "Revert "Merge branch 'master' of https://github.com/seaweedfs/seaweedfs""
This reverts commit 8cb42c39
Diffstat (limited to 'weed/shell/command_volume_fix_replication.go')
| -rw-r--r-- | weed/shell/command_volume_fix_replication.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go index 528dfbd2e..56f5f5532 100644 --- a/weed/shell/command_volume_fix_replication.go +++ b/weed/shell/command_volume_fix_replication.go @@ -328,8 +328,8 @@ func (c *commandVolumeFixReplication) fixOneUnderReplicatedVolume(commandEnv *Co func keepDataNodesSorted(dataNodes []location, diskType types.DiskType) { fn := capacityByFreeVolumeCount(diskType) - slices.SortFunc(dataNodes, func(a, b location) bool { - return fn(a.dataNode) > fn(b.dataNode) + slices.SortFunc(dataNodes, func(a, b location) int { + return int(fn(b.dataNode) - fn(a.dataNode)) }) } @@ -514,17 +514,17 @@ func countReplicas(replicas []*VolumeReplica) (diffDc, diffRack, diffNode map[st } func pickOneReplicaToDelete(replicas []*VolumeReplica, replicaPlacement *super_block.ReplicaPlacement) *VolumeReplica { - slices.SortFunc(replicas, func(a, b *VolumeReplica) bool { + slices.SortFunc(replicas, func(a, b *VolumeReplica) int { if a.info.Size != b.info.Size { - return a.info.Size < b.info.Size + return int(a.info.Size - b.info.Size) } if a.info.ModifiedAtSecond != b.info.ModifiedAtSecond { - return a.info.ModifiedAtSecond < b.info.ModifiedAtSecond + return int(a.info.ModifiedAtSecond - b.info.ModifiedAtSecond) } if a.info.CompactRevision != b.info.CompactRevision { - return a.info.CompactRevision < b.info.CompactRevision + return int(a.info.CompactRevision - b.info.CompactRevision) } - return false + return 0 }) return replicas[0] |
