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 7388F100A2 for ; Thu, 21 Nov 2013 07:35:26 +0000 (UTC) Received: (qmail 80343 invoked by uid 500); 21 Nov 2013 07:35:25 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 79274 invoked by uid 500); 21 Nov 2013 07:35:20 -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 79257 invoked by uid 99); 21 Nov 2013 07:35:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Nov 2013 07:35:18 +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: domain of kxepal@gmail.com designates 74.125.82.169 as permitted sender) Received: from [74.125.82.169] (HELO mail-we0-f169.google.com) (74.125.82.169) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Nov 2013 07:35:14 +0000 Received: by mail-we0-f169.google.com with SMTP id t60so5375253wes.0 for ; Wed, 20 Nov 2013 23:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=a9Cd/drrWam26gj8u61Fy006UqU+Jyoc2r8PI4bXqwo=; b=CFQOv/Zhcrd+kc/Np0iw4ZqFm2PZ1vpnO60/C7AbLo2/yDLvkIrc+teKg8hOBv/ix1 DViR7S1qzkO6dcTC+m4a7AsLZz7DgVekOiqWftZ/apXhOzWCKryu9mGxRV5LHN73J/0D xwZyGBqfBa3Wike0YQcNLKBVABHUMD3ErlDPPGcSLAt1JhvFF8jm1QlEjypZVHrknFWG tMrCDUeEG36CsTIQnmnvF61N3CePukw9PNo7b2VyWcB0/j5++acnVAXguTdaGy64cP3a b74LBokDZIalH9diwlprWzpDbzBEawYzljCX/MiajzH1VRNS1hICANMJy8pRfOZtLjmv P8bQ== MIME-Version: 1.0 X-Received: by 10.180.206.239 with SMTP id lr15mr18662560wic.35.1385019293629; Wed, 20 Nov 2013 23:34:53 -0800 (PST) Received: by 10.180.24.99 with HTTP; Wed, 20 Nov 2013 23:34:53 -0800 (PST) In-Reply-To: References: <77579B29-B4E6-4F06-A3D5-A7D7B360BD02@couchbase.com> Date: Thu, 21 Nov 2013 11:34:53 +0400 Message-ID: Subject: Re: [REVIEW] CouchDB Replication Protocol From: Alexander Shorin To: "dev@couchdb.apache.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Dale, Thanks for review! I agree, that there is need high level overview and reduce details. I'll take pause for few weeks to found good idea how to reorganise this document. For instance, API reference should be on top of the document while there shouldn't be too much details about couch_replicator routines. But indeed, this is how CouchDB replication works. This means, that by implementing the same API your peer would be able to handle push replication and run pull with easy. Otherwise, you're going to break the protocol. For instance, you say PouchDB doesn't work multipart/mixed content. That's might be ok for PouchDB-to-CouchDB replication, but if you run CouchDB-to-PouchDB it will fail due to lack of such support. By the same reason it will fail if you don't implement _ensure_full_commit endpoint. So, let's say there are two cases: when replication is served by CouchDB and when it's served by some other app (PouchDB, CouchBase Lite, etc.) For the last case you both are right: there is no need to implement all these things to have replication works and you may use any other CouchDB API to sync the documents. But for the first to have complete support pull and push replication you should do this otherwise replication will fall. I understand now all problems of my document (there is also lack of BigCouch/Cloudant specific), but where I should draw the line? During implementation of replipy (test dummy peer in python that is able to sync with CouchDB, but not host replication itself) I'd hit all these caveats, details and specifics - that's why I drop both DataProtocol and TouchDB algorithms. They are simple, but useless to make something from scratch. So from point of CouchDB you must implement all required API endpoints and content-type handling. But from point of PouchDB, CouchBase Lite, Cloudant etc. it seems that you may have different endpoints and replication will works different from couch_replicator. So I'm really confused how replication protocol should looks, but I feel that it must completely describe what happens when pull and push replication process is served by CouchDB, not by anything else. But I would be love to see any other ideas since this is just my point of view on this problem (: Thanks! -- ,,,^..^,,, On Wed, Nov 20, 2013 at 5:44 PM, Dale Harvey wrote: > Sorry for taking a while to look at this, busy with couchdb conf etc > > In general I agree with Jens, this serves as great documentation for how > CouchDB's replication works, but its very detailed without a high level > overview > > The PouchDB replicator was done following what Jens documented @ > https://github.com/couchbaselabs/TouchDB-iOS/wiki/Replication-Algorithmwh= ich > was invaluable > > Another problem is that its difficult to distinguish between an > implementation and a spec, a session id isnt needed for a pull replicatio= n, > revs diffs arent always needed, the details around the HTTP semantics > (especially the multipart/mixed) stuff is not relevant to PouchDB as Jens > mentioned, things like ensure_full_commit are quite specific > > I think one major improvement would be to restore the original high level > documentation (as seen @ > https://github.com/couchbaselabs/TouchDB-iOS/wiki/Replication-Algorithm o= r > http://dataprotocols.org/couchdb-replication/) and use the current detail= ed > sections as additional references > > As it is, one problem I can see would be: 4.2.4.1. Verify Peers would > suggest that its impossible to do pull replication if you dont have write > permissions on the database, I am not sure if thats because I am havig a > hard time following the diagram or thats what it is actually saying > > Thanks a lot for this work > > > > > > On 12 November 2013 06:21, Alexander Shorin wrote: > >> On Tue, Nov 12, 2013 at 9:35 AM, Benoit Chesneau >> wrote: >> > On Tuesday, November 12, 2013, Alexander Shorin wrote: >> >> https://github.com/kxepal/couchdb-replication-protocol >> > >> > hrmmm why another repo? i have created the hacking repo on my github f= or >> > that... Or we can like we said put all in a couchdb branch and >> collaborate >> > via git/github. At least i thought we decided that... >> >> Errr...that was unwise step from my side. Moved to CouchDB feature >> branch. Sorry! >> >> > will review in another mail. >> > >> > - beno=C3=AEt >> >> Thanks! >> >> -- >> ,,,^..^,,, >>