couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [13/23] fabric commit: updated refs/heads/windsor-merge to 4ec3f11
Date Fri, 01 Aug 2014 14:29:53 GMT
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/813e3437
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/813e3437
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/813e3437

Branch: refs/heads/windsor-merge
Commit: 813e34377b6bc59c7ebdbbeb9e5aed3fe27fd45f
Parents: 6408f7f
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Thu Dec 12 12:51:46 2013 -0600
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Aug 1 15:13:58 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/813e3437/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),


Mime
View raw message