Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5E197100ED for ; Thu, 20 Jun 2013 17:55:13 +0000 (UTC) Received: (qmail 40616 invoked by uid 500); 20 Jun 2013 17:55:12 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 40591 invoked by uid 500); 20 Jun 2013 17:55:11 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 40581 invoked by uid 99); 20 Jun 2013 17:55:11 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jun 2013 17:55:11 +0000 Received: from localhost (HELO mail-lb0-f176.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jun 2013 17:55:11 +0000 Received: by mail-lb0-f176.google.com with SMTP id z5so5928588lbh.21 for ; Thu, 20 Jun 2013 10:55:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ob+MK+ZfBD7oqKBdkeZqLYBhvqHbkwhgFGQ/fUp26iA=; b=EsAuL2gx5U59uIjDdwULw/j9EBNskSoYDYZhUfm17HsRk9RMSs2wbpsucczP622zyQ 86KNhe7IZpTfWXyZbFxl/LdNh+8gR8Sum8pNBaxSqC8euTkF4w8rI7JBJLrp1WP62eIJ 1eB+TU5l7sa66Lglqc4yv/0lIpgOubAIfKkdfJZxapY06Wv91X4n7vGxm3tGRtaou3Sz wrXWe9vd+sqIAFW2s6c1aJuUciBHI1ay4LKBDaWk4scyui7bAqy37H4tQWhsVkmsmL3f ZmDWEMvLT8Ini8Ziy5/Z571wzjCz6dXxk7HDK0m/pIdj3UYxSBCR891H6sE/vkTkhh0C H9PA== MIME-Version: 1.0 X-Received: by 10.152.4.232 with SMTP id n8mr4281390lan.29.1371750909607; Thu, 20 Jun 2013 10:55:09 -0700 (PDT) Received: by 10.112.168.66 with HTTP; Thu, 20 Jun 2013 10:55:09 -0700 (PDT) In-Reply-To: References: <6114AB2E-A404-4050-B415-DDF5C6F99241@couchbase.com> Date: Thu, 20 Jun 2013 18:55:09 +0100 Message-ID: Subject: Re: When is _replicate synchronous? From: Robert Newson To: "user@couchdb.apache.org" Cc: Filipe Manana Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable The history array is used so that the replicator can find a common replication record so we don't have to start from 0. On 20 June 2013 18:53, Robert Newson wrote: > the id version reflects an internal detail. The scheme for deriving > replication ids changes over time but to prevent redo-from-start, > we'll look for values generated with older versions of the scheme in > the event of a miss (a missing _local checkpoint doc). > > Is it necessary to CC Filipe's work email address? His apache.org > address should receive this. > > B. > > > On 20 June 2013 18:51, Robert Newson wrote: >> _replicate was always a blocking call, and then we added continuous >> replication. Obviously it then makes no sense to wait for "the end". >> >> B. >> >> >> On 20 June 2013 18:41, Jens Alfke wrote: >>> The wiki docs for _replicate don=92t say so, but in practice the call a= ppears to be synchronous unless the =91continuous=92 property is set. That = is, it doesn=92t return a response until the replication completes, and in = fact the response JSON includes a bunch of statistics about the replication= . >>> >>> I didn=92t know this when I implemented TouchDB, so I made _replicate a= lways asynchronous. (It made more sense to me, especially since my client c= ode needed to be able to track the progress of a replication using _active_= tasks, which meant it needed a response ASAP so it could get the task ID.) >>> >>> I=92m amending this now for Couchbase Lite, but I=92d like to make sure= I know the semantics. Is it true that it=92s always synchronous unless con= tinuous=3Dtrue, and then it=92s asynchronous? >>> >>> Also, is there any description somewhere of what the properties in the = synchronous response mean? Some are obvious, some less so. Here=92s an exam= ple from 1.2: >>> >>> { >>> "history": [ >>> { >>> "doc_write_failures": 0, >>> "docs_read": 18, >>> "docs_written": 18, >>> "end_last_seq": 19, >>> "end_time": "Thu, 20 Jun 2013 16:58:13 GMT", >>> "missing_checked": 18, >>> "missing_found": 18, >>> "recorded_seq": 19, >>> "session_id": "1cef7405d0e61fb0decc89323669a012", >>> "start_last_seq": 0, >>> "start_time": "Thu, 20 Jun 2013 16:58:13 GMT" >>> } >>> ], >>> "ok": true, >>> "replication_id_version": 2, >>> "session_id": "1cef7405d0e61fb0decc89323669a012", >>> "source_last_seq": 19 >>> } >>> >>> I=92m particularly curious (a) why =93history=94 is an array, and (b) w= hat =93replication_id_version=94 means. >>> >>> =97Jens