Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-52011

[CBM] Merge/restore fails when the last mutation in the first backup is in a collection deleted in the second

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 7.1.1
    • 7.1.0
    • tools
    • Untriaged
    • 1
    • Yes

    Description

      Reproduction

      1. Create two collections, c1 and c2
      2. Create a mutation to key 'A' in c1 and c2
      3. Do a backup
      4. Create a mutation 'B' in c1 and c2
      5. Delete c2
      6. Do a backup
      7. Do a restore/merge

      What should happen

      The merge or restore should complete and contain just 'A' and 'B' in c1

      What actually happens

      The merge/restore correctly transfers data from the first backup but during the second backup fails with a message such as:

      Error merging data: snapshot marker for vBucket 55 isn't valid {Timestamp:0 Start:0 End:5} -> {Timestamp:0 Start:4 End:6} 

      During a merge/restore we only transfer the data that will exist at the end, so if you delete a collection the mutations from it won't be transferred. We therefore advance the seqno to take account of any mutations in a deleted collection that happen after the last transferred mutation. Up to here the behaviour is correct. At the end of a transfer however we will flush the writer and then persist the last committed seqno - but this can be lower than the seqno we've advanced forward.

      In the example above we have the following mutations:

      backup 1:
      4 - c1 A
      5 - c2 A
      backup 2:
      6 - delete c1 

       so here we will advance to seqno 5 to take account of the creation of A in c2, but the last committed seqno will be 4 as it is the last mutation in an alive collection - ie one that we transfer. 

      Attachments

        Issue Links

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

          Activity

            People

              gilad.kalchheim Gilad Kalchheim
              Matt.Hall Matt Hall
              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