Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 499F611329 for ; Fri, 1 Aug 2014 09:11:52 +0000 (UTC) Received: (qmail 33121 invoked by uid 500); 1 Aug 2014 09:11:51 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 32899 invoked by uid 500); 1 Aug 2014 09:11:51 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 32039 invoked by uid 99); 1 Aug 2014 09:11:51 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Aug 2014 09:11:51 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 35ADD9BCC84; Fri, 1 Aug 2014 09:11:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rnewson@apache.org To: commits@couchdb.apache.org Date: Fri, 01 Aug 2014 09:12:38 -0000 Message-Id: In-Reply-To: <060e6729ffff41ea932f46fc2b63010d@git.apache.org> References: <060e6729ffff41ea932f46fc2b63010d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Fri Oct 25 22:59:23 2013 -0400 Committer: Robert Newson 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