couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [14/50] mem3 commit: updated refs/heads/master to 64c0c74
Date Thu, 28 Aug 2014 12:22:34 GMT
Preserve key and incorporate range into rotation key


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

Branch: refs/heads/master
Commit: 1d50774d269f749aa893518eb40b787241a0fa8c
Parents: 0efb85e
Author: Robert Newson <robert.newson@cloudant.com>
Authored: Tue Jun 25 12:37:33 2013 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Wed Jul 23 18:46:25 2014 +0100

----------------------------------------------------------------------
 src/mem3.erl | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/1d50774d/src/mem3.erl
----------------------------------------------------------------------
diff --git a/src/mem3.erl b/src/mem3.erl
index 0046fd4..af17d5c 100644
--- a/src/mem3.erl
+++ b/src/mem3.erl
@@ -262,7 +262,8 @@ group_by_proximity(Shards, ZoneMap) ->
 
 choose_ushards(DbName, Shards) ->
     Groups0 = group_by_range(Shards),
-    Groups1 = [rotate_list(DbName, order_shards(G)) || G <- Groups0],
+    Groups1 = [rotate_list(term_to_binary({DbName, R}), order_shards(G))
+               || {R, G} <- Groups0],
     [hd(G) || G <- Groups1].
 
 rotate_list(_Key, []) ->
@@ -277,10 +278,8 @@ order_shards(UnorderedShards) ->
     UnorderedShards.
 
 group_by_range(Shards) ->
-    Groups0 = lists:foldl(fun(Shard, Dict) ->
-        orddict:append(mem3:range(Shard), Shard, Dict) end, orddict:new(), Shards),
-    {_, Groups} = lists:unzip(Groups0),
-    Groups.
+    lists:foldl(fun(Shard, Dict) ->
+        orddict:append(mem3:range(Shard), Shard, Dict) end, orddict:new(), Shards).
 
 % quorum functions
 


Mime
View raw message