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

couchstore commit() may be incorrectly padding file size prior to first fsync, causing second fsync to do more work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.5.0
    • 2.5.0
    • Security Level: Public
    • None
    • May also affect earlier versions I observed this issue while reading couchstore codebase.
    • Untriaged
    • KV: Feb 2 - Feb 15

    Description

      I discussed this with Aaron in irc and he agreed there may be a problem.

      The code here:

      https://github.com/couchbase/couchstore/blob/master/src/couch_db.cc#L189-L193

      is attempting to extend the file size to account for the header which will subsequently be written after the first fsync. (this allows the second fsync to be an fdatasync, which avoids writing metadata)

      But, the headers need to be aligned on 4096-byte block boundaries and this calculation does not account for that. Further the db_write_buf() method does not account for that either.

      This means that in most cases, the file size will change again when we actually write header.

      Attachments

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

        Activity

          People

            will.gardner Will Gardner (Inactive)
            mschoch Marty Schoch [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty