sohva icon indicating copy to clipboard operation
sohva copied to clipboard

Implement replication conflict solving

Open satabin opened this issue 9 years ago • 0 comments

When replication process has been run, the conflicting revisions are present on all nodes, however even though the same winning revision is chosen, it is up to the clients to resolve the conflicts and delete the conflicting revisions once merged.

This can be done in several ways, among which:

  • periodic cleaning task
  • on first document retrieval
  • ...

Similarly to the automatic conflict resolution mechanism, it should be possible to get a Database instance which implements the conflict resolution on first retrieval. Moreover, giving access to a resolveConflicts method in Database can make it possible to implement any other cleaning strategy such as the periodic task.

Resolve on fetch

Add an argument to method CouchDB.database so that signature becomes

def database(name: String, credit: Int = 0, strategy: Strategy = BarneyStinsonStrategy, resolveOnFetch: Boolean = false): Database

The resolution strategy used is the same as for local conflict resolution.

Question: is the order of conflicting revision deterministic?

Explicit resolution

Add a method to Database

def resolveConflicts(strategy: Strategy): Future[List[DbResult]]

Returning for each conflicting document, the resolution status.

satabin avatar Nov 03 '16 16:11 satabin