Sync-gateway conflict resolution

As per documentation, conflict is handling by updating current winning revision document and deleting conflicted revision

will conflict resolve with deleting conflict branch only instead of updating current winning revision?

Hi - Can you elaborate your question with an example .

Suppose documents has two conflict branches below
"103-8e795f19581d47e4da620ec7988e8e52" and “60-1e795f19581d47e4de620ec7988e8e52”,

Winning revision is: "103-8e795f19581d47e4da620ec7988e8e52"
I have resolved conflict by making _deleted=true to conflicted branch(“60-1e795f19581d47e4de620ec7988e8e52”) only(Not updating current winning revision i.e “103-8e795f19581d47e4da620ec7988e8e52”)
hence we are getting below _sync metadata

"_sync": {
“rev”: “103-8e795f19581d47e4da620ec7988e8e52”,
“new_rev”: “61-5384584a19a24f5ea6a65e1c5c7f5053”,
“flags”: 20,
“sequence”: 133961,
“recent_sequences”: [

Is this valid way of conflict resolution?


Yes, the idea is that you want to tell others about the _deleted:true on that branch. Just make sure all the people who read and write documents in your system follow the some conflict resolution policy deterministically.

PRO TIP - Try to stay away from conflict resolution policy/rules based on timestamps inside documents. In the real world not every body is connected to the same atomic NTP server.

Thanks @househippo, we are identifying conflicts and deleting conflicts using documentation only.
will resolving conflict by only deleting conflicted branch(not updating current winning revision) be replicated by sg-replicator?


Yes, make sure that the rev_limit is not to short. Example the default is 1,000 that handles nearly most people history of changes in a document including _delete:true of a branch.