Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 24661 invoked from network); 1 Oct 2010 21:10:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Oct 2010 21:10:02 -0000 Received: (qmail 87291 invoked by uid 500); 1 Oct 2010 21:10:00 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 87197 invoked by uid 500); 1 Oct 2010 21:09:59 -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 87189 invoked by uid 99); 1 Oct 2010 21:09:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Oct 2010 21:09:59 +0000 X-ASF-Spam-Status: No, hits=4.3 required=10.0 tests=FS_REPLICA,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.214.180] (HELO mail-iw0-f180.google.com) (209.85.214.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Oct 2010 21:09:52 +0000 Received: by iwn8 with SMTP id 8so5843203iwn.11 for ; Fri, 01 Oct 2010 14:09:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.39.201 with SMTP id h9mr6326642ibe.27.1285967371318; Fri, 01 Oct 2010 14:09:31 -0700 (PDT) Received: by 10.231.15.1 with HTTP; Fri, 1 Oct 2010 14:09:31 -0700 (PDT) Date: Fri, 1 Oct 2010 17:09:31 -0400 Message-ID: Subject: Replication Question From: Oguzhan Eris To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 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. Thanks