Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Fix two bugs in the global balancing phase
* Nodes with 0 shards were being ignored because wrong datatype.
* The limit was being ignored because max not min.

BugzID: 24680
  • Loading branch information
kocolosk authored and rnewson committed Jul 23, 2014
1 parent 0b0a7e7 commit 51838ca25bd44ca287676e98d2c907205300eb58
Showing 1 changed file with 2 additions and 2 deletions.
@@ -138,8 +138,8 @@ global_expand(TargetNodes0, LocalOps, Limit) ->
({Node0, Count}, Acc) ->
Node = list_to_existing_atom(binary_to_list(Node0)),
% Compute the max number of shards to donate.
DC0 = erlang:max(Count - TargetLevel, Limit - length(Acc)),
InternalAcc0 = {Node, TargetNodes, Acc, DC0},
DC0 = erlang:min(Count - TargetLevel, Limit - length(Acc)),
InternalAcc0 = {Node, TargetNodes0, Acc, DC0},
try mem3_shards:fold(fun donate_fold/2, InternalAcc0) of
{_, _, Moves, _} ->
Moves

0 comments on commit 51838ca

Please sign in to comment.