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

When resuming an SQLite backup the incorrect chunk id is assigned to the chunk

    XMLWordPrintable

Details

    Description

      The new VBucketBackupWriter changed the way that we opened SQLite chunks on a resume, instead of opening all the chunks, we only open the latest chunk. The logic for setting the chunk id is slightly off due to an uint16 underflow.

      How does the open logic currently work?
      1) set chunk id to uint16(0)
      2) Loop and increment the chunk id until we don't find a chunk
      3) Open the latest chunk by calling open with chunk id - 1

      This causes and issue when the chunk id is 0 we will underflow to 65535; I mistakenly used the min value of (0, chunk id - 1). This therefore means when we resume and SQLite backup the chunk id will underflow, we will use the min(0, chunk id) which will be 0. This means when an SQLite backup resumes we will always start at chunk 0. This is the wrong behavior.

      How should the open logic work?
      1) Set the chunk id to int(0)
      2) Loop and increment the chunk id until we don't find a chunk
      3) Open the latest chunk by calling open with max(0, chunk id - 1)

      This means when opening the first chunk, we will open with max(0, -1), we open the chunk with the id 0.

      When opening chunks other than the first chunk we will open with the max(0, n) where n is larger than 0; this means we open the latest chunk.

      Attachments

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

        Activity

          People

            james.lee James Lee
            james.lee James Lee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty