couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [28/48] mem3 commit: updated refs/heads/windsor-merge to ff02b9a
Date Fri, 01 Aug 2014 09:11:14 GMT
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


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/51838ca2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/51838ca2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/51838ca2

Branch: refs/heads/windsor-merge
Commit: 51838ca25bd44ca287676e98d2c907205300eb58
Parents: 0b0a7e7
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Wed Oct 30 11:05:41 2013 -0400
Committer: Robert Newson <rnewson@apache.org>
Committed: Wed Jul 23 18:46:26 2014 +0100

----------------------------------------------------------------------
 src/mem3_rebalance.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/51838ca2/src/mem3_rebalance.erl
----------------------------------------------------------------------
diff --git a/src/mem3_rebalance.erl b/src/mem3_rebalance.erl
index 7e0826b..af050f6 100644
--- a/src/mem3_rebalance.erl
+++ b/src/mem3_rebalance.erl
@@ -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


Mime
View raw message