diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-11-12 13:47:36 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-11-12 13:47:36 -0800 |
| commit | 40514c53622fded6681f91d1c7d54045a5ef44c8 (patch) | |
| tree | ad96bbc923859f7c8a50b953f2377037f5feb717 /weed/shell/command_ec_balance.go | |
| parent | f056baa384f7c561574a7439d39b9746e52d7e23 (diff) | |
| download | seaweedfs-40514c53622fded6681f91d1c7d54045a5ef44c8.tar.xz seaweedfs-40514c53622fded6681f91d1c7d54045a5ef44c8.zip | |
add sortEcNodesByFreeslotsDecending and sortEcNodesByFreeslotsAscending
addressing https://github.com/chrislusf/seaweedfs/issues/1111
Diffstat (limited to 'weed/shell/command_ec_balance.go')
| -rw-r--r-- | weed/shell/command_ec_balance.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/weed/shell/command_ec_balance.go b/weed/shell/command_ec_balance.go index 8bf993f4a..9a70412c5 100644 --- a/weed/shell/command_ec_balance.go +++ b/weed/shell/command_ec_balance.go @@ -207,7 +207,7 @@ func doDeduplicateEcShards(ctx context.Context, commandEnv *CommandEnv, collecti if len(ecNodes) <= 1 { continue } - sortEcNodes(ecNodes) + sortEcNodesByFreeslotsAscending(ecNodes) fmt.Printf("ec shard %d.%d has %d copies, keeping %v\n", vid, shardId, len(ecNodes), ecNodes[0].info.Id) if !applyBalancing { continue @@ -442,7 +442,7 @@ func doBalanceEcRack(ctx context.Context, commandEnv *CommandEnv, ecRack *EcRack func pickOneEcNodeAndMoveOneShard(ctx context.Context, commandEnv *CommandEnv, expectedTotalEcShards int, existingLocation *EcNode, collection string, vid needle.VolumeId, shardId erasure_coding.ShardId, possibleDestinationEcNodes []*EcNode, applyBalancing bool) error { - sortEcNodes(possibleDestinationEcNodes) + sortEcNodesByFreeslotsDecending(possibleDestinationEcNodes) averageShardsPerEcNode := ceilDivide(expectedTotalEcShards, len(possibleDestinationEcNodes)) for _, destEcNode := range possibleDestinationEcNodes { |
