Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Revert "Remove maintenace modes from ushards"
This reverts commit deed2f0.

COUCHDB-2953
  • Loading branch information
Tony Sun committed Feb 26, 2016
1 parent deed2f0 commit 699308f510d335d05bfd0416ad5e893b68a7ec1d
Showing 2 changed files with 2 additions and 68 deletions.
@@ -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, []).

This file was deleted.

0 comments on commit 699308f

Please sign in to comment.