Repository: couchdb-mem3 Updated Branches: refs/heads/2953-ushards-mm [created] bfd83b4e9
Remove maintenace modes from ushards 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/f9dcbc21 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/f9dcbc21 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/f9dcbc21 Branch: refs/heads/2953-ushards-mm Commit: f9dcbc213c7590358222a751691ca0343f7a17af Parents: f208437 Author: Tony Sun <tony....@cloudant.com> Authored: Wed Feb 24 12:38:25 2016 -0800 Committer: Tony Sun <tony....@cloudant.com> Committed: Wed Feb 24 13:05:48 2016 -0800 ---------------------------------------------------------------------- src/mem3.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/f9dcbc21/src/mem3.erl ---------------------------------------------------------------------- diff --git a/src/mem3.erl b/src/mem3.erl index 405d7e5..48c7335 100644 --- a/src/mem3.erl +++ b/src/mem3.erl @@ -126,7 +126,7 @@ shards_int(DbName, DocId, Options) -> -spec ushards(DbName::iodata()) -> [#shard{}]. ushards(DbName) -> - Nodes = [node()|erlang:nodes()], + Nodes = non_maintenance_nodes(), ZoneMap = zone_map(Nodes), Shards = ushards(DbName, live_shards(DbName, Nodes, [ordered]), ZoneMap), mem3_util:downcast(Shards). @@ -254,6 +254,11 @@ allowed_nodes() -> 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"]. + live_shards(DbName, Nodes) -> live_shards(DbName, Nodes, []).