Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 30665 invoked from network); 18 Nov 2010 01:53:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Nov 2010 01:53:18 -0000 Received: (qmail 74833 invoked by uid 500); 18 Nov 2010 01:53:48 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 74766 invoked by uid 500); 18 Nov 2010 01:53:48 -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 74758 invoked by uid 99); 18 Nov 2010 01:53:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Nov 2010 01:53:48 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mikefedyk@gmail.com designates 74.125.82.180 as permitted sender) Received: from [74.125.82.180] (HELO mail-wy0-f180.google.com) (74.125.82.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Nov 2010 01:53:43 +0000 Received: by wya21 with SMTP id 21so2657045wya.11 for ; Wed, 17 Nov 2010 17:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=U5OB4Uu8qsQn5/dm4JQ+EAmf+tnRvcd67vBHwK7yS/I=; b=WQHZYHYSF9YwVU5qQx8h8+enXrd6aUVg9hYVdZbumdvVqA0GHOgToedeUqWVKCZSwM 66GOmbpyNWVpmX9XZkCGRbtWtimoWC11YtR3X428oAstCwqSfJ0iJZcBtcoI8a6lBG7v Kxq3S2rkYNdJkPL5Q1hlOLqnCoEVpOWgpbDQU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=WzzGF8XQkL1aIEt3nGPpevn9ZZU6OZZq5PKN+/bSXOpc5eKnB9l89ONSWv97yUISZF cAsM2Oz+TQ/G+/GRRmF9/V23FRVB3immRXaxzqjTMKukCoYnLtv70popE1/tpYZ7u4U1 f5pwZ/Ddo1GUEUtVuNKtmiYLAbakigp/bcYHk= MIME-Version: 1.0 Received: by 10.216.78.204 with SMTP id g54mr2424279wee.34.1290045201770; Wed, 17 Nov 2010 17:53:21 -0800 (PST) Sender: mikefedyk@gmail.com Received: by 10.216.17.200 with HTTP; Wed, 17 Nov 2010 17:53:21 -0800 (PST) In-Reply-To: References: <4ce418b2.096ee60a.57dd.7e17@mx.google.com> <23543823-7536-4620-AB61-A3AC8BAA43B8@apache.org> Date: Wed, 17 Nov 2010 17:53:21 -0800 X-Google-Sender-Auth: _DR6Rsvu1aveYW2n47GYKxnn9oY Message-ID: Subject: Re: Write race conditions, working without _rev From: Mike Fedyk To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 On Wed, Nov 17, 2010 at 5:14 PM, Randall Leeds wrote: > On Wed, Nov 17, 2010 at 16:15, Chad George wrote: >> I've been wondering about this for a while, when two update requests for the >> same document come to couchdb nearly simultaneously what exactly happens? >> >> Is it possible for both requests to get the same revision of the document to >> update or is there some mechanism to force the updates to occur in series? >> > > There is a mechanism. The message passing within the Erlang runtime > guarantee an ordering of messages to the update process. > It is impossible for both updates to occur. > I imagine that first in the queue wins in one instance of couchdb, but that doesn't tell the whole picture with two writes each on a separate instance of couchdb. At least the docs say that the sort order of the revs (including the md5 of the document), so whichever wins the sort will be the latest _rev. You want to design your apps to have as few write conflicts as possible, but you still need to be able to handle them when they do happen.