Mutating _rev on localDocument in conflict resolver results in merge error

Description

resolveDocMerge extracts the previous local rev from the mutable conflict.localDocument.  However, this may have been modified by the conflict resolver.  As a result, conflict resolvers that return a modified localDocument (stripping out _rev) will result in an error like:

Error resolving conflict for <ud>mydoc</ud>: Attempted to tombstone active revision for doc (mydoc), but provided rev () doesn't match current rev(14-f9841ac5d3bfa186fbd6f52d1f747cd8)
Any code that works with Conflict after conflict resolution has run should treat it as mutated, and only use when appropriate (rev check for local/remote wins, and body for merge)

Activity

Show:

CB robot July 26, 2021 at 5:41 PM

Build sync_gateway-3.0.0-301 contains sync_gateway commit e96fcbb with commit message:
: Use appropriate rev when utilizing a custom conflict resolver (#5118)

Adam Fraser June 18, 2021 at 4:41 PM

A new test should be written to exercise this - have a conflict resolver that results in a merge, and also mutates the value of local.rev and/or remote.rev, and ensure that the mutated revisions aren't used post-conflict resolution.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Sprint

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created February 23, 2021 at 12:58 AM
Updated August 3, 2021 at 3:53 PM
Resolved July 26, 2021 at 5:33 PM
Instabug