You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2018/07/17 12:39:28 UTC

[couchdb] 02/03: tidier

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch user-partitioned-dbs-wip
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit bbd263fb0c9d024f49e5bad475390c18b103a8eb
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Jul 16 15:23:00 2018 +0100

    tidier
---
 src/mem3/src/mem3.erl        | 10 +++++-----
 src/mem3/src/mem3_shards.erl |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mem3/src/mem3.erl b/src/mem3/src/mem3.erl
index 4b022ed..8a71b26 100644
--- a/src/mem3/src/mem3.erl
+++ b/src/mem3/src/mem3.erl
@@ -338,15 +338,15 @@ engine(Opts) when is_list(Opts) ->
     end.
 
 is_partitioned(DbName) when is_binary(DbName) ->
-    lists:all(fun is_partitioned/1, mem3:shards(DbName));
+    is_partitioned(mem3:shards(DbName));
+
+is_partitioned(Shards) when is_list(Shards) ->
+    lists:all(fun is_partitioned/1, Shards);
 
 is_partitioned(#shard{opts=Opts}) ->
-    is_partitioned(Opts);
+    lists:member(partitioned, Opts);
 
 is_partitioned(#ordered_shard{opts=Opts}) ->
-    is_partitioned(Opts);
-
-is_partitioned(Opts) when is_list(Opts) ->
     lists:member(partitioned, Opts).
 
 
diff --git a/src/mem3/src/mem3_shards.erl b/src/mem3/src/mem3_shards.erl
index 18ed82e..5b0b608 100644
--- a/src/mem3/src/mem3_shards.erl
+++ b/src/mem3/src/mem3_shards.erl
@@ -82,7 +82,7 @@ for_docid(DbName, DocId, Options) ->
             load_shards_from_disk(DbName, DocId);
         Shards0 ->
             gen_server:cast(?MODULE, {cache_hit, DbName}),
-            Options1 = case mem3:is_partitioned(hd(Shards0)) of
+            Options1 = case mem3:is_partitioned(Shards0) of
                 true  -> [partitioned];
                 false -> []
             end,