couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [29/50] fabric commit: updated refs/heads/windsor-merge-121 to 79e6e2f
Date Fri, 01 Aug 2014 09:12:17 GMT
Implement fabric_view:check_down_shards/2

This replaces fabric_view:remove_down_shards/2 with a check to see if a
rexi_DOWN message affects any of the worker shards. This is because we
monitor all the shards but are only handling messages from a single ring
which may not have included a node in the initial shards list.

We no longer need to remove shards on down nodes because once our stream
handling functions run as soon as we see a shard on a downed node we
know that progress is no longer possible under our current behavior.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/e4199a8e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/e4199a8e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/e4199a8e

Branch: refs/heads/windsor-merge-121
Commit: e4199a8e1dac8dca08b1edf349b0c3883c251180
Parents: f0c675e
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Tue Sep 10 20:56:27 2013 -0500
Committer: Robert Newson <rnewson@apache.org>
Committed: Thu Jul 31 13:55:55 2014 +0100

----------------------------------------------------------------------
 src/fabric_view.erl | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/e4199a8e/src/fabric_view.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view.erl b/src/fabric_view.erl
index 117dead..be41ce1 100644
--- a/src/fabric_view.erl
+++ b/src/fabric_view.erl
@@ -14,24 +14,27 @@
 
 -export([is_progress_possible/1, remove_overlapping_shards/2, maybe_send_row/1,
     transform_row/1, keydict/1, extract_view/4, get_shards/2,
-    remove_down_shards/2]).
+    check_down_shards/2]).
 
 -include_lib("fabric/include/fabric.hrl").
 -include_lib("mem3/include/mem3.hrl").
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("couch_mrview/include/couch_mrview.hrl").
 
--spec remove_down_shards(#collector{}, node()) ->
+%% @doc Check if a downed node affects any of our workers
+-spec check_down_shards(#collector{}, node()) ->
     {ok, #collector{}} | {error, any()}.
-remove_down_shards(Collector, BadNode) ->
+check_down_shards(Collector, BadNode) ->
     #collector{callback=Callback, counters=Counters, user_acc=Acc} = Collector,
-    case fabric_util:remove_down_workers(Counters, BadNode) of
-    {ok, NewCounters} ->
-        {ok, Collector#collector{counters = NewCounters}};
-    error ->
-        Reason = {nodedown, <<"progress not possible">>},
-        Callback({error, Reason}, Acc),
-        {error, Reason}
+    Filter = fun(#shard{node = Node}, _) -> Node == BadNode end,
+    BadCounters = fabric_dict:filter(Filter, Counters),
+    case fabric_dict:size(BadCounters) > 0 of
+        true ->
+            Reason = {nodedown, <<"progress not possible">>},
+            Callback({error, Reason}, Acc),
+            {error, Reason};
+        false ->
+            {ok, Collector}
     end.
 
 %% @doc looks for a fully covered keyrange in the list of counters


Mime
View raw message