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 12E97108F0 for ; Thu, 3 Oct 2013 18:48:28 +0000 (UTC) Received: (qmail 24477 invoked by uid 500); 3 Oct 2013 18:48:23 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 24407 invoked by uid 500); 3 Oct 2013 18:48:22 -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 24054 invoked by uid 99); 3 Oct 2013 18:48:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Oct 2013 18:48:19 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2C64790ED20; Thu, 3 Oct 2013 18:48:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: djc@apache.org To: commits@couchdb.apache.org Date: Thu, 03 Oct 2013 18:48:24 -0000 Message-Id: In-Reply-To: <9d3721ba72db4f6a821435db2e286c7b@git.apache.org> References: <9d3721ba72db4f6a821435db2e286c7b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/10] git commit: updated refs/heads/master to 4ca2cec Disable automatic retries of streaming writes An automatic retry makes no sense here, as we've already streamed part of the response body from the GET. Disabling the retries bubbles the error up to run_user_fun inside open_doc_revs allows us to retry the whole GET + PUT correctly. BugzID: 20822 Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/0b450507 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0b450507 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0b450507 Branch: refs/heads/master Commit: 0b450507670a4649255c2ac4c41d6aa7ae81e45a Parents: ba4e838 Author: Adam Kocoloski Authored: Thu Sep 12 17:13:07 2013 -0400 Committer: Adam Kocoloski Committed: Wed Oct 2 12:11:24 2013 -0400 ---------------------------------------------------------------------- src/couch_replicator/src/couch_replicator_api_wrap.erl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/0b450507/src/couch_replicator/src/couch_replicator_api_wrap.erl ---------------------------------------------------------------------- diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl index d8be12a..fccb759 100644 --- a/src/couch_replicator/src/couch_replicator_api_wrap.erl +++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl @@ -221,7 +221,7 @@ open_doc_revs(#httpdb{} = HttpDb, Id, Revs, Options, Fun, Acc) -> ), #httpdb{retries = Retries, wait = Wait0} = HttpDb, Wait = 2 * erlang:min(Wait0 * 2, ?MAX_WAIT), - twig:log(notice,"Retrying GET to ~s in ~p seconds due to error ~s", + twig:log(notice,"Retrying GET to ~s in ~p seconds due to error ~p", [Url, Wait / 1000, Else] ), ok = timer:sleep(Wait), @@ -278,7 +278,11 @@ update_doc(#httpdb{} = HttpDb, #doc{id = DocId} = Doc, Options, Type) -> end ++ [{"Content-Type", ?b2l(ContentType)}, {"Content-Length", Len}], Body = {fun stream_doc/1, {JsonBytes, Doc#doc.atts, Boundary, Len}}, send_req( - HttpDb, + % A crash here bubbles all the way back up to run_user_fun inside + % open_doc_revs, which will retry the whole thing. That's the + % appropriate course of action, since we've already started streaming + % the response body from the GET request. + HttpDb#httpdb{retries = 0}, [{method, put}, {path, encode_doc_id(DocId)}, {qs, QArgs}, {headers, Headers}, {body, Body}], fun(Code, _, {Props}) when Code =:= 200 orelse Code =:= 201 ->