Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-455

Inconsistent delta sync behavior regarding deletion

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.0, 2.6.0, 2.5.1
    • Fix Version/s: 2.6.0, 2.5.1
    • Component/s: SyncGateway
    • Security Level: Public
    • Sprint:
      CBG Sprint 27
    • Story Points:
      3

      Description

      Tested with 2.5.1-11

      The following steps were performed:

      1. Create a document on CBL
      2. Replicate to SG (non-continuous)
      3. Delete using SG REST API 
      4. Replicate to CBL (non-continuous)

      However, the resulting BLIP messages sent as a result of step 4 differ depending on whether or not delta sync is enabled.  Here is the message that is sent when it is not enabled:

      Frame Flags: Compressed|NoReply (0x28)
      Properties Length: 163
      Properties: rev:2-066de708b416c349d2d99f6b3a6e9329:deleted:1:sequence:12:history:1-070d1d91d6fb3b202607849c8796971a448b806b:Content-Type:application/json:Profile:rev:id:cbl_0
      Message Body: {}
      

      Versus when it is enabled:

      Frame Flags: Compressed|NoReply (0x28)
      Properties Length: 153
      Properties: Profile:rev:id:cbl_0:rev:2-f7563764e26b0816806c5d4c6d06a9d6:sequence:12:history:1-2dfe55a47f54a4350227fd5564729a0ad3380489:Content-Type:application/json
      Message Body: {"_removed":true}
      

      Technically the removed entry is the one that is correct, but annoyingly the desired behavior is more inline with the deletion. Regardless, it seems they should be unified.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

            Hide
            adamf Adam Fraser added a comment -

            This looks like it also affects 2.6.0. The delta code is passing isDeleted=false into db.authorizeUserForChannels in both scenarios - it needs to be checking whether the toRevision is deleted in both cases to properly set the deleted flag. In the second case (where it just pulled the toRevision from the revcache), it should be sufficient to check toRevision[BodyDeleted], since the rev cache stores the _deleted property in the body. The first case feels similar to ToChannels, where we'll need to store the property in the Delta in order to later recover it without the to/from body.

            Show
            adamf Adam Fraser added a comment - This looks like it also affects 2.6.0. The delta code is passing isDeleted=false into db.authorizeUserForChannels in both scenarios - it needs to be checking whether the toRevision is deleted in both cases to properly set the deleted flag. In the second case (where it just pulled the toRevision from the revcache), it should be sufficient to check toRevision [BodyDeleted] , since the rev cache stores the _deleted property in the body. The first case feels similar to ToChannels, where we'll need to store the property in the Delta in order to later recover it without the to/from body.
            Hide
            adamf Adam Fraser added a comment -

            If we can ensure that we never cache a delta in the first place when toRevision is deleted, we can avoid the extra property and I think would just need to add the check on toRevision[BodyDeleted] in the second case.

            Show
            adamf Adam Fraser added a comment - If we can ensure that we never cache a delta in the first place when toRevision is deleted, we can avoid the extra property and I think would just need to add the check on toRevision [BodyDeleted] in the second case.
            Hide
            build-team Couchbase Build Team added a comment -

            Build sync_gateway-2.6.0-125 contains sync_gateway commit 8e564b6 with commit message:
            CBG-455: Handle inconsistent tombstone format for deltas vs. non-deltas (#4198)

            Show
            build-team Couchbase Build Team added a comment - Build sync_gateway-2.6.0-125 contains sync_gateway commit 8e564b6 with commit message: CBG-455 : Handle inconsistent tombstone format for deltas vs. non-deltas (#4198)
            Hide
            build-team Couchbase Build Team added a comment -

            Build sync_gateway-2.5.1-12 contains sync_gateway commit 3f5ce5d with commit message:
            Backport CBG-455: Handle inconsistent tombstone format for deltas vs. non-deltas (#4198) (#4201)

            Show
            build-team Couchbase Build Team added a comment - Build sync_gateway-2.5.1-12 contains sync_gateway commit 3f5ce5d with commit message: Backport CBG-455 : Handle inconsistent tombstone format for deltas vs. non-deltas (#4198) (#4201)

              People

              • Assignee:
                ben.brooks Ben Brooks
                Reporter:
                jimb Jim Borden
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.