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/01 16:34:25 UTC

[04/49] fabric commit: updated refs/heads/windsor-merge to b1c0030

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/dc1f0141
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/dc1f0141
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/dc1f0141

Branch: refs/heads/windsor-merge
Commit: dc1f01416ccf14e8836f4da42ffbfb1da4524ca1
Parents: bea3052
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Sep 10 20:56:27 2013 -0500
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Aug 1 15:33:40 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/dc1f0141/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