Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C5D7112E6 for ; Fri, 1 Aug 2014 09:10:49 +0000 (UTC) Received: (qmail 20126 invoked by uid 500); 1 Aug 2014 09:10:48 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 19961 invoked by uid 500); 1 Aug 2014 09:10:48 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 19284 invoked by uid 99); 1 Aug 2014 09:10:48 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Aug 2014 09:10:48 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B697C9BCBCB; Fri, 1 Aug 2014 09:10:47 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rnewson@apache.org To: commits@couchdb.apache.org Date: Fri, 01 Aug 2014 09:10:58 -0000 Message-Id: <1b317d0a9029487fb29cad5b20cc485c@git.apache.org> In-Reply-To: <935ce6dd82fc4aef80d50b8c267346c1@git.apache.org> References: <935ce6dd82fc4aef80d50b8c267346c1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/48] mem3 commit: updated refs/heads/windsor-merge to ff02b9a 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/windsor-merge Commit: 1d50774d269f749aa893518eb40b787241a0fa8c Parents: 0efb85e Author: Robert Newson Authored: Tue Jun 25 12:37:33 2013 +0100 Committer: Robert Newson 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