couchdb-commits mailing list archives

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

This is a simple utility function that we can use to cancel a streaming
response when a worker dies. By the time we get here we know that
progress is no longer possible so we report the error and abort the
stream.


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

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

----------------------------------------------------------------------
 src/fabric_view.erl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/dae200f1/src/fabric_view.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view.erl b/src/fabric_view.erl
index be41ce1..690625b 100644
--- a/src/fabric_view.erl
+++ b/src/fabric_view.erl
@@ -14,7 +14,7 @@
 
 -export([is_progress_possible/1, remove_overlapping_shards/2, maybe_send_row/1,
     transform_row/1, keydict/1, extract_view/4, get_shards/2,
-    check_down_shards/2]).
+    check_down_shards/2, handle_worker_exit/3]).
 
 -include_lib("fabric/include/fabric.hrl").
 -include_lib("mem3/include/mem3.hrl").
@@ -37,6 +37,13 @@ check_down_shards(Collector, BadNode) ->
             {ok, Collector}
     end.
 
+%% @doc Handle a worker that dies during a stream
+-spec handle_worker_exit(#collector{}, #shard{}, any()) -> {error, any()}.
+handle_worker_exit(Collector, _Worker, Reason) ->
+    #collector{callback=Callback, user_acc=Acc} = Collector,
+    {ok, Resp} = Callback({error, fabric_util:error_info(Reason)}, Acc),
+    {error, Resp}.
+
 %% @doc looks for a fully covered keyrange in the list of counters
 -spec is_progress_possible([{#shard{}, term()}]) -> boolean().
 is_progress_possible([]) ->


Mime
View raw message