couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Fedyk <mfe...@mikefedyk.com>
Subject Re: Write race conditions, working without _rev
Date Thu, 18 Nov 2010 01:53:21 GMT
On Wed, Nov 17, 2010 at 5:14 PM, Randall Leeds <randall.leeds@gmail.com> wrote:
> On Wed, Nov 17, 2010 at 16:15, Chad George <chad@mgproducts.com> 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.

Mime
View raw message