Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 29338 invoked from network); 7 Nov 2010 02:25:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Nov 2010 02:25:22 -0000 Received: (qmail 18823 invoked by uid 500); 7 Nov 2010 02:25:52 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 18775 invoked by uid 500); 7 Nov 2010 02:25:51 -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 18767 invoked by uid 99); 7 Nov 2010 02:25:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Nov 2010 02:25:51 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of couchdbuser@gmail.com designates 209.85.216.52 as permitted sender) Received: from [209.85.216.52] (HELO mail-qw0-f52.google.com) (209.85.216.52) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Nov 2010 02:25:46 +0000 Received: by qwc9 with SMTP id 9so3616228qwc.11 for ; Sat, 06 Nov 2010 19:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=DE6bl510UDFIcEQnvRDx6dlnzGC1K6zXM2NELAYjQ4o=; b=e5fy99rkWhfrM19u/As8MBWGuzwKGdHjthRXT5s07jWCXK/7k2bLd2IvZb5RATrUad JrLljPIR23OwUq9eWUhjG9317ANrZzswZCH50ao+PlCFjaK39ueiS/0obne1bll+M3mA aX04gN/9OwmwJ13+9AOZmi/XBNZMe78s/t3Pk= 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; b=UuqMvbtpe67vswif0jL/UnIHL8iDqmi0FdhXqky/3+NoDEcn8kMtivM0C/2rw3ijli VK/GvVfP+xoqVTxZzjwCG1fmJMEx7TqwTiM5JeKu72fvJnSvDm5fuZWQZMyvY+LPGEs1 +n7KH3/jyLOw373pqWwIPhXkfup2oFjaSMmaA= MIME-Version: 1.0 Received: by 10.229.224.137 with SMTP id io9mr3570299qcb.206.1289096724830; Sat, 06 Nov 2010 19:25:24 -0700 (PDT) Received: by 10.229.17.14 with HTTP; Sat, 6 Nov 2010 19:25:24 -0700 (PDT) In-Reply-To: References: Date: Sat, 6 Nov 2010 22:25:24 -0400 Message-ID: Subject: Re: Write race conditions, working without _rev From: couchdb user To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 To follow up on what Chad said about avoiding reading the doc to get the _rev, you can also use a HEAD request, while it is an extra request, it will use a lot less resources. $ curl -HEAD http://127.0.0.1:5984/example/post98 {"_id":"post98","_rev":"1-9e6543bfb3cbf3b7c36904a1ea4b806f","tags":"[2,5]"} Regards, On Sat, Nov 6, 2010 at 3:52 PM, Luciano Ramalho wrote: > On Fri, Nov 5, 2010 at 2:03 PM, Paul Davis wrote: >> In the second case, the second person to write the document wins, >> erasing any changes the first write's effects. The first writer will >> then be in a state where his view of the database will be >> inconsistent. The thing his, he can't know because without requiring a >> _rev token he'll never get a notification of any sort of error. > > As I understand, the situation you describe above never happens in > practice with CouchDB. A second PUT to the same document _id will > always require the _rev attribute, so there's no way to overwrite a > previous update by accident. This is one of the best features of > CouchDB for document-oriented persistency. > > > -- > Luciano Ramalho > programador repentista || stand-up programmer > Twitter: @luciano >