couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [40/50] fabric commit: updated refs/heads/windsor-merge-121 to 79e6e2f
Date Fri, 01 Aug 2014 09:12:28 GMT
Provide replacement shards in map views

BugzId: 20423


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

Branch: refs/heads/windsor-merge-121
Commit: 5d9a0e55926c8a70dd923d7e408932cd7ab262ad
Parents: 4f639ce
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Thu Sep 12 10:22:00 2013 -0500
Committer: Robert Newson <rnewson@apache.org>
Committed: Thu Jul 31 16:19:14 2014 +0100

----------------------------------------------------------------------
 src/fabric_view_map.erl | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/5d9a0e55/src/fabric_view_map.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_map.erl b/src/fabric_view_map.erl
index cf70568..d2c010a 100644
--- a/src/fabric_view_map.erl
+++ b/src/fabric_view_map.erl
@@ -25,11 +25,15 @@ go(DbName, GroupId, View, Args, Callback, Acc0) when is_binary(GroupId)
->
 
 go(DbName, DDoc, View, Args, Callback, Acc) ->
     Shards = fabric_view:get_shards(DbName, Args),
-    Workers0 = fabric_util:submit_jobs(
-            Shards, fabric_rpc, map_view, [DDoc, View, Args]),
+    Repls = fabric_view:get_shard_replacements(DbName, Shards),
+    RPCArgs = [DDoc, View, Args],
+    StartFun = fun(Shard) ->
+        hd(fabric_util:submit_jobs([Shard], fabric_rpc, map_view, RPCArgs))
+    end,
+    Workers0 = fabric_util:submit_jobs(Shards, fabric_rpc, map_view, RPCArgs),
     RexiMon = fabric_util:create_monitors(Workers0),
     try
-        case fabric_util:stream_start(Workers0, #shard.ref) of
+        case fabric_util:stream_start(Workers0, #shard.ref, StartFun, Repls) of
             {ok, Workers} ->
                 try
                     go(DbName, Workers, Args, Callback, Acc)
@@ -74,11 +78,6 @@ handle_message({rexi_DOWN, _, {_, NodeRef}, _}, _, State) ->
 handle_message({rexi_EXIT, Reason}, Worker, State) ->
     fabric_view:handle_worker_exit(State, Worker, Reason);
 
-handle_message({rexi_EXIT, Reason}, _, State) ->
-    #collector{callback=Callback, user_acc=Acc} = State,
-    {ok, Resp} = Callback({error, fabric_util:error_info(Reason)}, Acc),
-    {error, Resp};
-
 handle_message({meta, Meta0}, {Worker, From}, State) ->
     Tot = couch_util:get_value(total, Meta0, 0),
     Off = couch_util:get_value(offset, Meta0, 0),


Mime
View raw message