48

The CouchDB Replication and Conflicts wiki page suggests using _bulk_docs with all_or_nothing=true to forcibly write new versions of documents even if that introduces conflicts on write, but then resolve shortly after on subsequent reads. I've implemented this and conceptually it seems to work OK.

But BigCouch doesn't support all_or_nothing semantics so writes to bulk docs can return 409 Conflict results. What is the best practice for implementing similar app-level conflict resolution for conflicts introduced by replication in BigCouch? Should I look at write-time conflict resolution instead?

akent
  • 4,068
  • 28
  • 27
  • Oops, I asked a question that wasn't about C#. – akent Jul 12 '12 at 22:48
  • That could be a bit of a problem. If you want we could have a quick chat in the chat.SO [CouchDB and Couchbase](http://chat.stackoverflow.com/rooms/11630/couchdb-and-couchbase) chat room. – Octavian Helm Aug 05 '12 at 14:05
  • @akent if you find any solution after the chat can you please post it as an answer to your own question... the subject is very interesting to me. – Daniele B Apr 30 '13 at 22:07

1 Answers1

1

Get the revision number of the document to be updated if there is a conflict during attachment and recursively call in-case of a conflict,

$url = "http://couchdb/DATABASE/DOCID/ATTACHMENTNAME?rev=$rev";
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_PUT, true );
curl_setopt( $ch, CURLOPT_URL, $url );
curl_exec( $ch );
  • I'm not sure what attachments has to do with this. This doesn't look like a solution to me. – akent Sep 25 '13 at 00:44