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 2014/08/01 11:11:13 UTC
[27/48] mem3 commit: updated refs/heads/windsor-merge to ff02b9a
Refuse to place shards on decom:true nodes
BugzID: 24420
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/45b040b4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/45b040b4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/45b040b4
Branch: refs/heads/windsor-merge
Commit: 45b040b4c6bb554a4ee496735ec6701c6b5f7c42
Parents: d7a4f26
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Wed Oct 23 10:08:51 2013 -0400
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Jul 23 18:46:26 2014 +0100
----------------------------------------------------------------------
src/mem3.erl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/45b040b4/src/mem3.erl
----------------------------------------------------------------------
diff --git a/src/mem3.erl b/src/mem3.erl
index 864cddb..cc76454 100644
--- a/src/mem3.erl
+++ b/src/mem3.erl
@@ -157,7 +157,7 @@ choose_shards(DbName, Options) when is_list(DbName) ->
choose_shards(DbName, Options) ->
try shards(DbName)
catch error:E when E==database_does_not_exist; E==badarg ->
- Nodes = mem3:nodes(),
+ Nodes = allowed_nodes(),
case get_placement(Options) of
undefined ->
choose_shards(DbName, Nodes, Options);
@@ -237,6 +237,9 @@ range(<<"shards/", Start:8/binary, "-", End:8/binary, "/", _/binary>>) ->
[httpd_util:hexlist_to_integer(binary_to_list(Start)),
httpd_util:hexlist_to_integer(binary_to_list(End))].
+allowed_nodes() ->
+ [Node || Node <- mem3:nodes(), mem3:node_info(Node, <<"decom">>) =/= true].
+
nodes_in_zone(Nodes, Zone) ->
[Node || Node <- Nodes, Zone == mem3:node_info(Node, <<"zone">>)].