couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Power <Michael.Po...@ELOTOUCH.com>
Subject CouchDB choose winning conflict within view
Date Mon, 09 Nov 2015 21:44:43 GMT
I would like to implement a conflict resolution mechanism using a latest wins strategy.  The
“latest" criteria is an application specific logic.

I have been reading: https://wiki.apache.org/couchdb/Replication_and_conflicts

Currently it looks like the suggested approach is to write a view that would detect the conflicts
and then write a batch job to roll over those conflicts.  I would like to implement a more
lazy approach to conflict resolution.  Why create the revs when the default deterministic
winner is fine?

First I would need to change which winner is selected, because I want the latest update. 
My initial thought was to write a view that could emit the appropriate record that was the
winner.  Then I could write the view’s map logic to enumerate the conflicts select the one
that is the latest and emit that.  Based on the documentation the only information given per
record for a conflict is the _revs that represent the other conflicting records.  Is there
anyway to configure a view to give me all conflicting _revs and their bodies in one go, so
I can choose the one to emit?

Second I would like to make it easy to resolve the conflict once I have chosen the winner.
 Rather then writing a bulk operation to resolve the conflict I thought it would be nice if
I could resolve the conflict along with a PUT.  I was wondering if I round trip the _conflicts
array from the DB to its client and back again, is the DB intelligent enough to recognize
the update as a conflict resolution?

Michael Power
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message