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

compaction sets incorrect block type for offset 0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 7.0.0
    • 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 4.0.0, 4.1.0, 4.1.1, 4.1.2, 4.5.0, 4.5.1, 4.6.0, 4.6.1, 4.6.4, 4.6.2, 4.6.3, 4.6.5, 5.0.0, 5.0.1, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.5.0, 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.5, 5.5.6, 5.5.5-MP2, 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.5.1, 6.6.0, 6.5.0, Cheshire-Cat
    • storage-engine
    • None
    • Untriaged
    • No

    Description

      When you try to open a coucstore database (for creation) it'll start off by writing a header block at offset 0. That database header isn't really that interesting as there isn't any data in the database yet (a good question would probably be: why was it written in the first place instead of delaying until the first commit as there is no data in the database).

      As part of compaction we want to get rid of all unused space in the file, and this block don't contain any data so we want to get rid of it. In order to achieve that we set the file pointer to 1 so that we'll start writing data at offset 1. The problem is that we didn't update the magic byte for the block from 1 (header) to 0 (data).

      The only time this is a problem is if one tries to read out the header block at file offset 0 as the magic say it should contain a header, but there is no header there. In a "normal" situation this won't happen (you should have at least 1 valid header, otherwise compaction would have failed), so opening the database works as expected. The problem manifests itself if you try to iterate the headers you can't differentiate not finding a new header (you reached the beginning of the file) and the fact that there is a corruption on the header stored at the given block.

      Attachments

        Issue Links

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

          Activity

            People

              trond Trond Norbye
              trond Trond Norbye
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty