Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-2884

revpos is missing in the changed attachment body when using delta sync

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 3.0.2
    • 3.0
    • LiteCore
    • Security Level: Public
    • None
    • Pasin 67, Pasin 68
    • 3

    Description

      This issue is found during the todo test fest between CBL iOS 3.0.1 and SG 3.0 EE with delta sync enabled (setting "delta_sync":

      { "enabled": true}

      in SG config for the database).

      How to reproduce :

      1. Start todo app and login with a user.
      2. Create a task list.
      3. Create a task.
      4. Update a task twice (check and uncheck) to generate a couple of revisions.
      5. Add an image to the test.
      6. Update an image to the test.

      In the Step 5, CBL sent the rev message as follows:

      {"type":"task","complete":false,"task":"Task1","taskList":{"owner":"user1","id":"user1.C2A33691-EE4D-497D-B6E4-DAB5424998BE"},"createdAt":"2022-03-03T19:08:25.651Z",
          "image":{"length":2051240,"digest":"sha1-yNrLH9jxGSDhenJZvYSOUXWgnhQ=","content_type":"image/jpeg","@type":"blob"},"
          _attachments":{"blob_/image":{"length":2051240,"digest":"sha1-yNrLH9jxGSDhenJZvYSOUXWgnhQ=","content_type":"image/jpeg","stub":true,"revpos":4}}}
      

      In the Step 6, CBL sent the rev message including only the attachment due to delta sync enabled.

      {"_attachments":{"blob_/image":{"content_type":"image/jpg","digest":"sha1-UzFeXdWAt/GoJ4y0ak0IH82sJg0=","length":500554}},
          "image":{"content_type":"image/jpg","digest":"sha1-UzFeXdWAt/GoJ4y0ak0IH82sJg0=","length":500554}}
      

      The attachment info above doesn't include the revpos=5.

      With that above, when using SG 3.0, the end result will cause the mismatch sha-1 digests stored in the SG as below:

      {"_attachments":{"blob_/image":{"content_type":"image/jpeg","digest":"sha1-yNrLH9jxGSDhenJZvYSOUXWgnhQ=","length":2051240,"revpos":4,"stub":true}},"_id":"-oyDVcP3l1qOsuZixcXap9W","_rev":"5-450d033bdaca325ce8edd0e974b9d8426f3630a4","complete":false,"createdAt":"2022-03-03T19:08:25.651Z","image":{"@type":"blob","content_type":"image/jpg","digest":"sha1-UzFeXdWAt/GoJ4y0ak0IH82sJg0=","length":500554},"task":"Task1","taskList":{"id":"user1.C2A33691-EE4D-497D-B6E4-DAB5424998BE","owner":"user1"},"type":"task"}
      

      Attachments

        Issue Links

          Activity

            People

              pasin Pasin Suriyentrakorn
              pasin Pasin Suriyentrakorn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty