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 11:12:38 UTC

[50/50] fabric commit: updated refs/heads/windsor-merge-121 to 79e6e2f

Report errors opening documents during _all_docs

All errors are currently ignored in the receive statements and
eventually we timeout.  This patch causes fabric to report the error and
terminate quickly instead of waiting.

BugzID: 24580


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

Branch: refs/heads/windsor-merge-121
Commit: 79e6e2fd179982c35a0264f39a9c5c267face1d1
Parents: df0cd0b
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Fri Oct 25 22:59:23 2013 -0400
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Jul 31 20:16:20 2014 +0100

----------------------------------------------------------------------
 src/fabric_view_all_docs.erl | 39 +++++++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/79e6e2fd/src/fabric_view_all_docs.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_all_docs.erl b/src/fabric_view_all_docs.erl
index 28a1f91..cda748a 100644
--- a/src/fabric_view_all_docs.erl
+++ b/src/fabric_view_all_docs.erl
@@ -69,12 +69,17 @@ go(DbName, Options, QueryArgs, Callback, Acc0) ->
         false -> Keys2
     end,
     Timeout = fabric_util:all_docs_timeout(),
-    receive {'DOWN', Ref0, _, _, {ok, TotalRows}} ->
-        {ok, Acc1} = Callback({meta, [{total, TotalRows}]}, Acc0),
-        {ok, Acc2} = doc_receive_loop(
-            Keys3, queue:new(), SpawnFun, MaxJobs, Callback, Acc1
-        ),
-        Callback(complete, Acc2)
+    receive {'DOWN', Ref0, _, _, Result} ->
+        case Result of
+            {ok, TotalRows} ->
+                {ok, Acc1} = Callback({meta, [{total, TotalRows}]}, Acc0),
+                {ok, Acc2} = doc_receive_loop(
+                    Keys3, queue:new(), SpawnFun, MaxJobs, Callback, Acc1
+                ),
+                Callback(complete, Acc2);
+            Error ->
+                Callback({error, Error}, Acc0)
+        end
     after Timeout ->
         Callback(timeout, Acc0)
     end.
@@ -178,15 +183,21 @@ doc_receive_loop(Keys, Pids, SpawnFun, MaxJobs, Callback, AccIn) ->
     _ ->
         {{value, {Pid, Ref}}, RestPids} = queue:out(Pids),
         Timeout = fabric_util:all_docs_timeout(),
-        receive {'DOWN', Ref, process, Pid, #view_row{} = Row} ->
-            case Callback(fabric_view:transform_row(Row), AccIn) of
-            {ok, Acc} ->
-                doc_receive_loop(
-                    Keys, RestPids, SpawnFun, MaxJobs, Callback, Acc
-                );
-            {stop, Acc} ->
+        receive {'DOWN', Ref, process, Pid, Row} ->
+            case Row of
+            #view_row{} ->
+                case Callback(fabric_view:transform_row(Row), AccIn) of
+                {ok, Acc} ->
+                    doc_receive_loop(
+                        Keys, RestPids, SpawnFun, MaxJobs, Callback, Acc
+                    );
+                {stop, Acc} ->
+                    cancel_read_pids(RestPids),
+                    {ok, Acc}
+                end;
+            Error ->
                 cancel_read_pids(RestPids),
-                {ok, Acc}
+                Callback({error, Error}, AccIn)
             end
         after Timeout ->
             timeout