You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by to...@apache.org on 2016/02/25 20:12:11 UTC

mem3 commit: updated refs/heads/2953-ushards-mm to 8668ca6

Repository: couchdb-mem3
Updated Branches:
  refs/heads/2953-ushards-mm bfd83b4e9 -> 8668ca60a


Preserve order

The previous multi-call did not take into account that multi-call
is async and could possibly be out of order.

COUCHDB-2953


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

Branch: refs/heads/2953-ushards-mm
Commit: 8668ca60a77ed57842820baaafcf0038c643f8fe
Parents: bfd83b4
Author: Tony Sun <to...@cloudant.com>
Authored: Thu Feb 25 11:10:48 2016 -0800
Committer: Tony Sun <to...@cloudant.com>
Committed: Thu Feb 25 11:10:48 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/8668ca60/src/mem3.erl
----------------------------------------------------------------------
diff --git a/src/mem3.erl b/src/mem3.erl
index 48c7335..85093cd 100644
--- a/src/mem3.erl
+++ b/src/mem3.erl
@@ -13,7 +13,7 @@
 -module(mem3).
 
 -export([start/0, stop/0, restart/0, nodes/0, node_info/2, shards/1, shards/2,
-    choose_shards/2, n/1, n/2, dbname/1, ushards/1]).
+    choose_shards/2, n/1, n/2, dbname/1, ushards/1, get_maintenance_mode/0]).
 -export([get_shard/3, local_shards/1, shard_suffix/1, fold_shards/2]).
 -export([sync_security/0, sync_security/1]).
 -export([compare_nodelists/0, compare_shards/1]).
@@ -80,6 +80,11 @@ nodes() ->
 node_info(Node, Key) ->
     mem3_nodes:get_node_info(Node, Key).
 
+-spec get_maintenance_mode() -> {node(), Mode::list()}.
+get_maintenance_mode() ->
+    Mode = config:get("couchdb", "maintenance_mode", "false"),
+    {node(), Mode}.
+
 -spec shards(DbName::iodata()) -> [#shard{}].
 shards(DbName) ->
     shards_int(DbName, []).
@@ -255,9 +260,8 @@ nodes_in_zone(Nodes, Zone) ->
     [Node || Node <- Nodes, Zone == mem3:node_info(Node, <<"zone">>)].
 
 non_maintenance_nodes() ->
-    Nodes = [node() | erlang:nodes()],
-    {Modes, _} = rpc:multicall(config, get, ["couchdb", "maintenance_mode"]),
-    [N || {N, Mode} <- lists:zip(Nodes, Modes), Mode =/= "true", Mode =/= "nolb"].
+    {Modes, _} = rpc:multicall(mem3, get_maintenance_mode, []),
+    [N || {N, Mode} <- Modes, Mode =:= "false"].
 
 live_shards(DbName, Nodes) ->
     live_shards(DbName, Nodes, []).