Dealing with conflicts caused by replication in BigCouch
Asked Answered
G

1

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?

Gerena answered 1/7, 2012 at 3:42 Comment(3)
Oops, I asked a question that wasn't about C#.Gerena
That could be a bit of a problem. If you want we could have a quick chat in the chat.SO CouchDB and Couchbase chat room.Hurl
@Gerena 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.Proctoscope
C
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 );
Cardin answered 7/6, 2013 at 12:13 Comment(1)
I'm not sure what attachments has to do with this. This doesn't look like a solution to me.Gerena

© 2022 - 2024 — McMap. All rights reserved.