incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Leeds <>
Subject Re: avoiding races with concurrent invocations on different couchdb instances... was: CouchDB hosting services and same-domain origin
Date Tue, 30 Nov 2010 21:24:49 GMT
Sad to see you never got a response to this. It's been sitting starred
in my inbox for a while.

On Fri, Nov 12, 2010 at 05:17, Mike Fedyk <> wrote:
> On Fri, Nov 5, 2010 at 12:50 PM, Gabriel Farrell <> wrote:
>> If you're wondering how to do this for a CouchApp, you might look at
>> the setup Mikeal talks about (NodeJS behind CouchDB) at
>> (especially at around 12:15).
> Does he or anyone go into more detail on methods for coordinating
> action evocation based on replication (ie, _changes)?  I don't like
> the idea of one app hanging off one instance of couchdb.  then you
> still have to implement failover detection, etc.  if it starts with
> all nodes being active, but maybe the first one starts once it's new,
> and the second hits if it's 5 minutes old, etc. or I was thinking of a
> distributed queue but in order to take an item off the queue, you have
> to "take ownership" of it, and get acks from N other couch instances
> to make sure you're not racing with them...
> Has anyone thought of this type of stuff and elaborated on it?

I've thought about it only little, but your idea of "taking ownership"
seems sound, but it's hard to imagine immediately how it'd actually
work. It's easy to update a document to say "I'm the owner" and if
that replicates cleanly such that you see it on N couches you should
be assured that you've taken that item. If there are conflicts, Couch
will take care of making sure all replicas choose the same version, so
the same process should work. You should try it out by hanging on the
_changes feed of 3 couches and set them all replicating continuously.
See if you can "claim" documents by updating an "owner" field or
something. Let us know how it goes!

View raw message