Hi Oguzhan, On Fri, Oct 1, 2010 at 5:09 PM, Oguzhan Eris <e...@ekls.com> wrote: > I'm trying to find some more information on how exactly replication > "fits-in" with things like validation functions. > > My question is based on the following scenario. > > Have a cluster of cross replicating couchdb's where each can be > written to independently. > > If a big network outage causes the clusters to be split, the > databases will continue to work on their side of the network and > replicate to the ones they can access to. So in this split brain > scenario, we are likely to have conflicts when the network outage is > restored. > > What I'd like to be able todo is, control replication through a > validation function which is as simple as if (oldDoc && > oldDoc.lastModifiedTime < newDoc.lastModifiedTime) { throw(forbidden)} > > Assuming timestamps are always in sync and lastmodifiedtime represents > the time the doc was last updated by the respective system, all I want > is to not have a document be replicated to my instance if I have a > newer copy. > > I have tried various ways to mimic this behavior but I really can't > tell if it's working and whether replication updates run through a > validate_doc_update. > > I realize I can detect a conflict later and do something about it, but > I really would prefer not to have conflicts at all and deal with them > on-update instead of post-update.
I believe this is all handled internally by couchdb, it is part of the bidirectional conflict resolution couchdb uses. Regards, > > Thanks >