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/28 14:21:16 UTC
[41/50] fabric commit: updated refs/heads/master to a71701c
Only attempt replacement when we have replacements
We weren't checking if we were even provided replacements before using
them. This just adds a guard so we don't end up with a badmatch error on
the `lists:keytake/3`.
BugzId: 26124
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/2e98455e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/2e98455e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/2e98455e
Branch: refs/heads/master
Commit: 2e98455e881a8b9d450b1baf831e531c04ceca3d
Parents: 4d9106e
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Dec 12 12:51:46 2013 -0600
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Aug 1 15:33:43 2014 +0100
----------------------------------------------------------------------
src/fabric_util.erl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/2e98455e/src/fabric_util.erl
----------------------------------------------------------------------
diff --git a/src/fabric_util.erl b/src/fabric_util.erl
index 642d7d6..5f59725 100644
--- a/src/fabric_util.erl
+++ b/src/fabric_util.erl
@@ -86,13 +86,14 @@ handle_stream_start({rexi_DOWN, _, {_, NodeRef}, _}, _, St) ->
end;
handle_stream_start({rexi_EXIT, Reason}, Worker, St) ->
Workers = fabric_dict:erase(Worker, St#stream_acc.workers),
+ Replacements = St#stream_acc.replacements,
case {fabric_view:is_progress_possible(Workers), Reason} of
{true, _} ->
{ok, St#stream_acc{workers=Workers}};
- {false, {maintenance_mode, _Node}} ->
+ {false, {maintenance_mode, _Node}} when Replacements /= undefined ->
% Check if we have replacements for this range
% and start the new workers if so.
- case lists:keytake(Worker#shard.range, 1, St#stream_acc.replacements) of
+ case lists:keytake(Worker#shard.range, 1, Replacements) of
{value, {_Range, WorkerReplacements}, NewReplacements} ->
FinalWorkers = lists:foldl(fun(Repl, NewWorkers) ->
NewWorker = (St#stream_acc.start_fun)(Repl),