Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1B6401074F for ; Thu, 30 Jan 2014 14:02:00 +0000 (UTC) Received: (qmail 62324 invoked by uid 500); 30 Jan 2014 14:01:57 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 62060 invoked by uid 500); 30 Jan 2014 14:01:56 -0000 Mailing-List: contact dev-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 dev@couchdb.apache.org Received: (qmail 62041 invoked by uid 99); 30 Jan 2014 14:01:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jan 2014 14:01:56 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [80.244.253.218] (HELO mail.traeumt.net) (80.244.253.218) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jan 2014 14:01:52 +0000 Received: from [10.0.0.14] (91-66-82-235-dynip.superkabel.de [91.66.82.235]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.traeumt.net (Postfix) with ESMTPSA id 4F5A120091; Thu, 30 Jan 2014 15:02:14 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_6CEBD386-9A1D-4B20-AF05-CAE22A9D0C7B"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1812\)) Subject: Re: Help with a replicator incompatibility/crash? From: Jan Lehnardt In-Reply-To: <48AFCAF8-72E4-4D0C-80C2-C458F6F74677@apache.org> Date: Thu, 30 Jan 2014 15:01:29 +0100 Cc: replication@couchdb.apache.org Message-Id: References: <48AFCAF8-72E4-4D0C-80C2-C458F6F74677@apache.org> To: "dev@couchdb.apache.org Developers" X-Mailer: Apple Mail (2.1812) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_6CEBD386-9A1D-4B20-AF05-CAE22A9D0C7B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 I commented with a summary on the ticket again: = https://github.com/couchbase/sync_gateway/issues/248#issuecomment-33689652= I talked this over with @rnewson. The scenario appears to be this: ``` [14:39:41] <+rnewson> but for the replicator to know to fetch = "_design/foo" the source must have said it in the changes feed. [14:40:06] <+rnewson> if the source says "_design/foo" was updated = *and* 404's when you fetch it, I don't see how it's the replicators = problem. ``` In CouchDB, the above scenario is still possible, but rather rare. In = addition, CouchDB will retry this if it fails and unless you look at the = docs, you are none the wiser that this has happened. The solution here is two-fold: 1. CouchDB should add a clause to handle non-200 responses and print a = sensible error message about violating replication protocol expectations = (we really need a proper spec soon). 2. sync_gateway should not send a _changes feed line for documents that = can result in a 404, and/or handle the fact that CouchDB (pre-fix) bails = on that or (post-fix) returns a sensible error. On 30 Jan 2014, at 14:47 , Adam Kocoloski wrote: > Correct, the CouchDB replicator fails on a 404 there. There are = relatively few occasions where the replicator will skip data and run to = completion -- explicit validate_doc_update rejections and MD5 mismatches = on attachments are two that come to mind. >=20 > We could / should have the discussion about whether the replicator = should make progress in the event of other failure modes like this one. = I could make a case for it, but I worry that no one will pay attention = to any warning message or metric that gets reported. >=20 > Adam >=20 > On Jan 30, 2014, at 8:19 AM, Jan Lehnardt wrote: >=20 >> I commented on the issue: >>=20 >> It looks like we are not handling a 404 in the function below, = especially thefun(200, Headers, StreamDataFun) -> bit (that=92s like 171 = in couch_replicator_api_wrap). >>=20 >> I=92m not too familiar with that code, maybe one of Adam, Bob, = Filipe, Benoit could have a look? >>=20 >> cc dev@ >>=20 >> open_doc_revs(#httpdb{} =3D HttpDb, Id, Revs, Options, Fun, Acc) -> >> Path =3D encode_doc_id(Id), >> QArgs =3D options_to_query_args( >> HttpDb, Path, [revs, {open_revs, Revs} | Options]), >> Self =3D self(), >> Streamer =3D spawn_link(fun() -> >> send_req( >> HttpDb, >> [{path, Path}, {qs, QArgs}, >> {ibrowse_options, [{stream_to, {self(), once}}]}, >> {headers, [{"Accept", "multipart/mixed"}]}], >> fun(200, Headers, StreamDataFun) -> >> remote_open_doc_revs_streamer_start(Self), >> {<<"--">>, _, _} =3D = couch_httpd:parse_multipart_request( >> get_value("Content-Type", Headers), >> StreamDataFun, >> fun mp_parse_mixed/1) >> end), >> unlink(Self) >> end), >> receive >> {started_open_doc_revs, Ref} -> >> receive_docs_loop(Streamer, Fun, Id, Revs, Ref, Acc) >> end; >>=20 >> On 29 Jan 2014, at 16:35 , Jens Alfke wrote: >>=20 >>> A developer has reported a CouchDB 1.3 exception/crash replicating = with the Couchbase Sync Gateway. They've attached the Erlang crash = report, but those are about as readable to me as ancient Aramaic, or the = logos* of black-metal bands :( >>>=20 >>> = https://github.com/couchbase/sync_gateway/issues/248#issuecomment-33523814= >>>=20 >>> Could someone who knows CouchDB take a look and give me a clue about = what it might be taking exception [sic] to? In my experience, there are = some areas where it gets very picky about parsing incoming data, for = example the number of newlines at the end of a multipart body. If I had = some idea what type of data it was reading when it barfed, that would = help me figure this out... >>>=20 >>> Thanks! >>>=20 >>> =97Jens >>>=20 >>> * viz.: = http://www.rottentomatoes.com/quiz/the-most-unreadable-metal-band-logos/ >>=20 >=20 --Apple-Mail=_6CEBD386-9A1D-4B20-AF05-CAE22A9D0C7B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQIcBAEBCgAGBQJS6ls5AAoJENnuAeR4Uq7kfM0QAJ6IERcIc675Gt0tiDfiuDo7 GFr1UUe3To6D1+zC1JNGUUS8TdkIEKt3EkxLokLNOeyF6kC+UoFp2R6weuepNC5e v9WRsqPrGv3y96w6bobfcCBl1A8lEuaQOBGieOuyMAqEnZsGGyLnHEE+SSyJFNWU eWbXLmnd+oC7/1jCq3Psu+5nHJeex7S0uT4PBT6SnFJcL3lJvqquHv00Su2ApciC UMDqRtlEd89yiURJYFyyA8v3cKasEbiVYeaFTbwrUEZ/ZZXsfPsZl3MvkH/xZaVl Nn2KMtQXl6tbh8dK17IAkTR9aBLWx/rA7XXK/bnbsCCEtPdrH5axxIR77SZLTzTX iCbFX6yPo3BuuBvLZSm27BQ5cWC7JlJcQZBr9IMOE/q1MKToKexM+ritn9OQBSD/ f22js31axQIR+DTWg01nDlJyskeikPHf2BugDnmhTkEglx78hCPtcEWDrQ443iCU lVsqwdg/oSU1KqKqbYKJZS8AlPb6sLJzPAsKBFeAlpdX/adt+YXwzwmQG5bBcSOl MC0VQGAw3DLQgFdy+0FdQV/5pGwo9GuXSgIkfcpqd/QdMU++HxXEtfWTjenb+j6Q Rp0dwGCcUJgeTk/BK9utPfohsQEgWwnTFgoNKlTfOBhdiWyr3CgNoLZHIwlhi5JQ gh4FptuXyAIFZEYxtW+D =nlP1 -----END PGP SIGNATURE----- --Apple-Mail=_6CEBD386-9A1D-4B20-AF05-CAE22A9D0C7B--