Skip to content

Commit

Permalink
increased ns_config access timeouts in ns_config_rep
Browse files Browse the repository at this point in the history
Failed ns_config_rep init() can bring down whole server during
restarts. This change makes it more persistent.

Change-Id: I60ef93d3f98f254cd1c865273aeede9f1de680c6
Reviewed-on: http://review.membase.org/3557
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Sean Lynch <seanl@literati.org>
  • Loading branch information
Aliaksey Kandratsenka authored and Sean Lynch committed Nov 8, 2010
1 parent 92a4cce commit 0fbbb84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ns_config_rep.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

-behaviour(gen_server).

-define(PULL_TIMEOUT, 10000).
-define(SELF_PULL_TIMEOUT, 30000).

% How to launch the thing.
-export([start_link/0]).

Expand Down Expand Up @@ -110,7 +113,7 @@ schedule_config_sync() ->
timer:send_after(Frequency, self(), sync_random).

do_push() ->
do_push(ns_config:get_remote(node())).
do_push(ns_config:get_remote(node(), ?SELF_PULL_TIMEOUT)).

do_push(RawKVList) ->
do_push(RawKVList, ns_node_disco:nodes_actual_other()).
Expand All @@ -126,7 +129,7 @@ do_pull([], _N) -> ok;
do_pull(_Nodes, 0) -> error;
do_pull([Node | Rest], N) ->
error_logger:info_msg("Pulling config from: ~p~n", [Node]),
case (catch ns_config:get_remote(Node)) of
case (catch ns_config:get_remote(Node, ?PULL_TIMEOUT)) of
{'EXIT', _, _} -> do_pull(Rest, N - 1);
{'EXIT', _} -> do_pull(Rest, N - 1);
RemoteKVList -> ns_config:merge(RemoteKVList),
Expand Down

0 comments on commit 0fbbb84

Please sign in to comment.