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

Support CBL clients that don't increment revpos when attachment body changes



    • Improvement
    • Resolution: Fixed
    • Major
    • 3.1.0
    • 3.0
    • SyncGateway
    • Security Level: Public
    • CBG Sprint 94
    • 8


      CBL clients using delta sync are incorrectly not incrementing an attachment's revpos when the attachment contents change when using delta sync.

      This results in the attachment not being updated when the revision is pushed to Sync Gateway - delta sync merges the incoming _attachment property with the previous one, resulting in the older revpos value. Since the revpos is old, Sync Gateway assumes it already knows about this attachment and doesn't update the _attachment metadata.

      Here's an example. This is the initial payload sent by CBL for the first version of the attachment:


      The attachment is updated on the client, and CBL sends this delta:


      Since revpos isn't included in the delta, the _attachments content doesn't get updated on the SG side, resulting in this:


      Prior to Sync Gateway 3.0 this worked. I believe this is due to revpos being computed conservatively prior to 3.0, as a side effect of shared attachment storage. That's been fixed in 3.0, but has exposed this existing CBL issue.

      There will be a CBL fix to correct the revpos value, but we'd like to explore whether Sync Gateway can also be more defensive in this case, to provide backward compatibility with non-patched CBL clients. In addition to the revpos check, evaluate whether we can check for differences in attachment digest, and override the client's revpos value when that differs (to set the revpos to the current rev generation).


        Issue Links

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



              jacques.rascagneres Jacques Rascagneres
              adamf Adam Fraser
              0 Vote for this issue
              1 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes