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 A862893E0 for ; Thu, 29 Dec 2011 01:36:29 +0000 (UTC) Received: (qmail 72357 invoked by uid 500); 29 Dec 2011 01:36:29 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 72313 invoked by uid 500); 29 Dec 2011 01:36:29 -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 72305 invoked by uid 99); 29 Dec 2011 01:36:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2011 01:36:29 +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 (nike.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2011 01:36:22 +0000 Received: by vbbfk1 with SMTP id fk1so13276362vbb.11 for ; Wed, 28 Dec 2011 17:36:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=3HBSx76fdmL6G1ZcM918Lusqtnl8OEjA7YgWeZv+H+Y=; b=MyKI9lAivpazUFrxzuTFCryPOxJ0hfJ2JvMR0oKWIHQYKCCVAeoBRRp8/1O42H3SXu zRSux9+32um/11vxfp5WuqLQMlH4XAsR2VZEnAdJxZTn0teg7PHCVVa2kg55aniYzmBZ MPUf5hL15z2bcRruR0XZs4/unM5HQ+9XVP5iM= Received: by 10.52.93.240 with SMTP id cx16mr16045379vdb.99.1325122561248; Wed, 28 Dec 2011 17:36:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.47.137 with HTTP; Wed, 28 Dec 2011 17:35:20 -0800 (PST) In-Reply-To: References: <2073127356.24602.1324243590757.JavaMail.tomcat@hel.zones.apache.org> <1765975633.44958.1324877790680.JavaMail.tomcat@hel.zones.apache.org> From: Paul Davis Date: Wed, 28 Dec 2011 19:35:20 -0600 Message-ID: Subject: Re: [jira] [Commented] (COUCHDB-1367) When settings revs_limit on db - the db increases its update_seq counter when viewing stats - but not when getting changes To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Dec 28, 2011 at 7:02 PM, Damien Katz wrote: > > On Dec 28, 2011, at 4:21 PM, Jason Smith wrote: > >> On Thu, Dec 29, 2011 at 1:44 AM, Randall Leeds = wrote: >>> On Tue, Dec 27, 2011 at 22:37, Jason Smith wrote: >>>> On Wed, Dec 28, 2011 at 9:38 AM, Randall Leeds wrote: >>>>> On Tue, Dec 27, 2011 at 05:22, Jason Smith wrote: >>>>>> On Tue, Dec 27, 2011 at 5:04 AM, Randall Leeds wrote: >>>> Your idea improves consistency and orthogonality. It also solves the >>>> problem of how to enumerate _local docs. (AFAIK there is no way to >>>> list them all, not via _all_docs, or _changes, or a view). >>>> >>>> But it doesn't solve the larger problem: How to follow a _changes feed >>>> and know when you have caught up. Both Bob N. and I independently did >>>> the following for our projects: >>>> >>>> 1. GET /db and wrongly assume update_seq will appear in the changes fe= ed >>>> 2. GET /db/_changes?feed=3Dcontinuous >>>> 3. Break when a change has .seq >=3D update_seq >>>> >>>> Suppose you have step 0: Update _security or _revs_limit. The loop >>>> will never break. >>>> >>>> You propose (WLOG) _changes?comprehensive=3Dtrue which guarantees a >>>> change equal or greater than update_seq. That's cool, but IMO app >>>> developers now have to add code to ignore irrelevant changes like >>>> those containing replication checkpoints. >>> >>> All great points. >>> >>>> >>>> I propose (WLOG) update_sikh in the db header which is the seq id of >>>> the latest *document* update. App developers modify their step 1 to >>>> use update_sikh instead of update_seq. >>>> >>>> Is that an accurate synopsis? >>> >>> Yes. If we decide to go this route I would rather see _revs_limit and >>> _security stop bumping update_seq because I find it confusing that >>> update_seq is then not directly related to the by_seq tree. >> >> "update_seq is not directly related to the by_seq tree." That is a >> very powerful observation. My idea has less orthogonality and >> conceptual simplicity. >> >> The only mystery is why update_seq did this in the first place. Did >> Damien have a reason, from hard-won experience? > > I wanted to give an easy way to monitor other changes to the database hea= der, for things like automated backup and admin tool UIs, though I don't kn= ow if anything uses it. It was easiest to do it this way, and I ddn't think= about the problems it might cause with users expecting it to correspond wi= th the by_seq index. With all the confusion it's caused, I'd be fine with t= aking it out. Or maybe put in a db version_seq header, that's like a change= s feed but for all types of updates to the db. > Having a _changes and _events feed I think makes good sense. It could get us away from the db update notifier stuff as well if we consolidated things in there. Though as a note we need to remember to fix the triggering mechanism for _view updates because of _purge. I think the simplest way would be to just check both the _update and _purge seq's instead of just relying on _purge to have changed the _update seq. Luckily we store both of these thigns already so it should just be a matter of updating the logic in the guards when grabbing a view group. >> >>> The one exception raised so far is your observation that >>> it may be useful for doing backups. However, if that's the only real >>> exception, perhaps we should surface some other thing more directly >>> analogous to the UNIX crime. >> >> Meh, the backups argument is okay, but weak. If you depend on it, >> you'll miss _local docs (replication checkpoints, so that's no small >> error). You still have to back up .ini files, and perhaps logs and >> view files. So my suggestion for Unix crime is just that: OS >> timestamps. >> >> -- >> Iris Couch >