Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 90570 invoked from network); 26 Feb 2010 18:03:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Feb 2010 18:03:35 -0000 Received: (qmail 38590 invoked by uid 500); 26 Feb 2010 18:03:33 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 38557 invoked by uid 500); 26 Feb 2010 18:03:33 -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 38549 invoked by uid 99); 26 Feb 2010 18:03:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Feb 2010 18:03:33 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of robert.newson@gmail.com designates 209.85.219.211 as permitted sender) Received: from [209.85.219.211] (HELO mail-ew0-f211.google.com) (209.85.219.211) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Feb 2010 18:03:25 +0000 Received: by ewy3 with SMTP id 3so269944ewy.35 for ; Fri, 26 Feb 2010 10:03:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=9pO8VsxEb0C34rWbYQ2esUMTFzMFsvk/dga6QpQ16ow=; b=pLYvaLztOQZ59ccF+4v9CfLSeT5YJRk7yo3WSUc2mJ5bVdrz1GfB+K9eu+cmzZm1Ii b1ID93BnH8s0V4JMTVhLA3Zasow3Udi7VMDIPDtLO3Q7LdXarJ3FJkqF1z1hJewo/LhZ QtxRWuzaToMJxQcbcTmLfAAg707j93YkAMLYI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=wOCvZOnNoZTIvg3dyZrB0RGp5PRt9fbrbGdJJU6771biHyKz41/px3bEZ8O6vCzue1 EOvUrta6AIIlMOgu1UsWpNbRuw3UBgsIYQVpbGV2iu4UviHN6Y1bPLdOsOT0c4c0pS5i yfzEiqeHtSSj4u5W4WEJvqAXhYOhC8hP5BKvU= MIME-Version: 1.0 Received: by 10.216.176.143 with SMTP id b15mr623684wem.155.1267207385535; Fri, 26 Feb 2010 10:03:05 -0800 (PST) In-Reply-To: <2C90E1D1-38E9-4CDF-BCDE-CDDF4E72BC37@mooseyard.com> References: <2C90E1D1-38E9-4CDF-BCDE-CDDF4E72BC37@mooseyard.com> Date: Fri, 26 Feb 2010 13:03:05 -0500 Message-ID: <46aeb24f1002261003n3b3cb481w3e47ac69d6ac185b@mail.gmail.com> Subject: Re: Consistent version of a view across multiple queries? From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org You can query with stale=3Dok and the view won't change (as long as no other call happens without stale=3Dok). You'll have to call without stale=3Dok sometimes, though, so you'll still need to take care. Does that help? B. On Fri, Feb 26, 2010 at 11:27 AM, Jens Alfke wrote: > If an app wants to iterate over a large view, it seems better to page the= output by issuing multiple queries, using the startkey=3D and limit=3D par= ameters. However, this seems to introduce race conditions if another client= is meanwhile altering the database. I might see half of the documents befo= re the change and half after. For example, I might see a document show up t= wice with two different key values. > > Is there any way to avoid this inconsistency? In a SQL database I'd use a= transaction for this, to lock out any database updates in between my serie= s of SELECTs. But CouchDB's architecture doesn't support that. > > It seems like what I want is to specify some kind of clock (timestamp / r= evision #) in my view queries, so they all run over the exact same view b-t= ree. This seems straightforward at the level of the CouchDB file-format, si= nce it's append-only and the previous view b-tree still exists in the file.= But is this exposed in the API at all? > > =97Jens