diff options
| author | guosj <515878133@qq.com> | 2022-04-19 09:25:32 +0800 |
|---|---|---|
| committer | guosj <515878133@qq.com> | 2022-04-19 09:25:32 +0800 |
| commit | 82ee31965dd7a1ad2d348c7e9dadb254744bf9b0 (patch) | |
| tree | 593eb933dffc877010c761b2c55ec6c73875e9a3 /weed/shell/command_ec_common.go | |
| parent | 5c9a3bb8cf68ed99acb53dd548c92b54744d7fd7 (diff) | |
| parent | e6ebafc094dc0ce0e3b0a68d7735f52a544bc479 (diff) | |
| download | seaweedfs-82ee31965dd7a1ad2d348c7e9dadb254744bf9b0.tar.xz seaweedfs-82ee31965dd7a1ad2d348c7e9dadb254744bf9b0.zip | |
Merge branch 'master' of https://github.com/chrislusf/seaweedfs into chrislusf-master
Diffstat (limited to 'weed/shell/command_ec_common.go')
| -rw-r--r-- | weed/shell/command_ec_common.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.go index b3bd0ce5d..27b650731 100644 --- a/weed/shell/command_ec_common.go +++ b/weed/shell/command_ec_common.go @@ -3,18 +3,17 @@ package shell import ( "context" "fmt" - "github.com/chrislusf/seaweedfs/weed/pb" - "github.com/chrislusf/seaweedfs/weed/storage/types" - "math" - "sort" - "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/operation" + "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb" "github.com/chrislusf/seaweedfs/weed/storage/erasure_coding" "github.com/chrislusf/seaweedfs/weed/storage/needle" + "github.com/chrislusf/seaweedfs/weed/storage/types" + "golang.org/x/exp/slices" "google.golang.org/grpc" + "math" ) func moveMountedShardToEcNode(commandEnv *CommandEnv, existingLocation *EcNode, collection string, vid needle.VolumeId, shardId erasure_coding.ShardId, destinationEcNode *EcNode, applyBalancing bool) (err error) { @@ -116,14 +115,14 @@ func eachDataNode(topo *master_pb.TopologyInfo, fn func(dc string, rack RackId, } func sortEcNodesByFreeslotsDecending(ecNodes []*EcNode) { - sort.Slice(ecNodes, func(i, j int) bool { - return ecNodes[i].freeEcSlot > ecNodes[j].freeEcSlot + slices.SortFunc(ecNodes, func(a, b *EcNode) bool { + return a.freeEcSlot > b.freeEcSlot }) } func sortEcNodesByFreeslotsAscending(ecNodes []*EcNode) { - sort.Slice(ecNodes, func(i, j int) bool { - return ecNodes[i].freeEcSlot < ecNodes[j].freeEcSlot + slices.SortFunc(ecNodes, func(a, b *EcNode) bool { + return a.freeEcSlot < b.freeEcSlot }) } |
