couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonysu...@apache.org
Subject mem3 commit: updated refs/heads/master to 699308f
Date Fri, 26 Feb 2016 17:31:59 GMT
Repository: couchdb-mem3
Updated Branches:
  refs/heads/master deed2f0eb -> 699308f51


Revert "Remove maintenace modes from ushards"

This reverts commit deed2f0eb15d634a643312e71e343c1e19e1b07e.

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/699308f5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/699308f5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/699308f5

Branch: refs/heads/master
Commit: 699308f510d335d05bfd0416ad5e893b68a7ec1d
Parents: deed2f0
Author: Tony Sun <tony.sun@cloudant.com>
Authored: Fri Feb 26 09:04:42 2016 -0800
Committer: Tony Sun <tony.sun@cloudant.com>
Committed: Fri Feb 26 09:04:42 2016 -0800

----------------------------------------------------------------------
 src/mem3.erl               | 13 ++--------
 test/mem3_ushards_test.erl | 57 -----------------------------------------
 2 files changed, 2 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/699308f5/src/mem3.erl
----------------------------------------------------------------------
diff --git a/src/mem3.erl b/src/mem3.erl
index 85093cd..405d7e5 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, get_maintenance_mode/0]).
+    choose_shards/2, n/1, n/2, dbname/1, ushards/1]).
 -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,11 +80,6 @@ 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, []).
@@ -131,7 +126,7 @@ shards_int(DbName, DocId, Options) ->
 
 -spec ushards(DbName::iodata()) -> [#shard{}].
 ushards(DbName) ->
-    Nodes = non_maintenance_nodes(),
+    Nodes = [node()|erlang:nodes()],
     ZoneMap = zone_map(Nodes),
     Shards = ushards(DbName, live_shards(DbName, Nodes, [ordered]), ZoneMap),
     mem3_util:downcast(Shards).
@@ -259,10 +254,6 @@ allowed_nodes() ->
 nodes_in_zone(Nodes, Zone) ->
     [Node || Node <- Nodes, Zone == mem3:node_info(Node, <<"zone">>)].
 
-non_maintenance_nodes() ->
-    {Modes, _} = rpc:multicall(mem3, get_maintenance_mode, []),
-    [N || {N, Mode} <- Modes, Mode =:= "false"].
-
 live_shards(DbName, Nodes) ->
     live_shards(DbName, Nodes, []).
 

http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/699308f5/test/mem3_ushards_test.erl
----------------------------------------------------------------------
diff --git a/test/mem3_ushards_test.erl b/test/mem3_ushards_test.erl
deleted file mode 100644
index 4ee2854..0000000
--- a/test/mem3_ushards_test.erl
+++ /dev/null
@@ -1,57 +0,0 @@
-% Licensed under the Apache License, Version 2.0 (the "License"); you may not
-% use this file except in compliance with the License. You may obtain a copy of
-% the License at
-%
-%   http://www.apache.org/licenses/LICENSE-2.0
-%
-% Unless required by applicable law or agreed to in writing, software
-% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-% License for the specific language governing permissions and limitations under
-% the License.
-
--module(mem3_ushards_test).
-
--include_lib("couch/include/couch_eunit.hrl").
--include_lib("couch/include/couch_db.hrl").
--include_lib("mem3/include/mem3.hrl").
-
--define(TIMEOUT, 10000).
-
-setup() ->
-    DbName = ?tempdb(),
-    ok = fabric:create_db(DbName, [?ADMIN_CTX]),
-    DbName.
-
-teardown(DbName) ->
-    ok = fabric:delete_db(DbName, [?ADMIN_CTX]).
-
-ushard_test_() ->
-    {
-        "Maintenance node test",
-        {
-            setup,
-            fun() -> test_util:start_couch([mem3]) end,
-            fun test_util:stop/1,
-            {
-                foreach,
-                fun setup/0, fun teardown/1,
-                [
-                    fun maintenance_mode_true/1,
-                    fun maintenance_mode_nolb/1
-                ]
-            }
-        }
-    }.
-
-maintenance_mode_true(DbName) ->
-    config:set("couchdb", "maintenance_mode", "true"),
-    UShards = mem3:ushards(DbName),
-    Nodes = [Node || #shard{node=Node} <- UShards, Node =:= node()],
-    ?_assertEqual([], Nodes).
-
-maintenance_mode_nolb(DbName) ->
-    config:set("couchdb", "maintenance_mode", "nolb"),
-    UShards = mem3:ushards(DbName),
-    Nodes = [Node || #shard{node=Node} <- UShards, Node =:= node()],
-    ?_assertEqual([], Nodes).


Mime
View raw message