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

CBL revpos handling causes attachment fetch per write for docs with attachments



    • Bug
    • Resolution: Fixed
    • Major
    • 3.1.0
    • 3.0
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 95, CBG Sprint 96
    • 3


      When pushing a mutation to a document with an attachment, CBL is setting the attachment revpos to the generation of the current revid, instead of the revision at which the attachment is added.  This has been the CBL behaviour since at least CBL 2.5.

      This results in Sync Gateway treating the attachment as new to Sync Gateway, and results in a Sync Gateway fetching the attachment from Couchbase Server in order to generate a proveAttachment request.

      This will create a lot of unnecessary network traffic between SG and CBS for highly mutated documents with attachments.  

      In addition, the attachment fetch is always being performed based on the v2 attachment key.  As a result, legacy attachments with the CBL updated revpos are always being treated as not found, and triggering GetAttachment handling.  This performs an unintended migration of attachments to the v2 storage model.  

      In cases where the attachment is already present with matching digest on the common ancestor of the incoming revision and the active revision, proveAttachment should not be performed, regardless of revpos.  This will address the above issues.



        Issue Links

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



              adamf Adam Fraser
              adamf Adam Fraser
              0 Vote for this issue
              1 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes