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

Couchstore rewind_db_header might read back the entire file

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • Morpheus
    • 7.6.0, 6.6.6, 7.0.0, 7.1.0, 7.2.0, 7.0.6, 7.1.6, 7.2.5
    • couchbase-bucket
    • 0

    Description

      Upon rollback, we will execute:

        CouchKVStore::rollback > couchstore_rewind_db_header > find_header

      The find_header function will read backwards through the .couch file, looking for a db_header. We will rewind until we see a header with a seqno lower than the rollback seqno. In the case where we're having to rollback soon after compaction, the Couchstore file might look like this:

      [   header 1 @ seqno: 10000000  ][   header 2 @ seqno:  100000050  ]

      Assume rollback_seqno = 999999. In this case, we will rewind back to header 2, then to 1.

      The second rewind will read the entire vBucket file, which can be very slow (we've seen > 10 minutes).

      Since we don't find a "recent header", we discard everything and rollback to 0.

      The final couchstore_rewind_db_header step can be optimised away – we could store an additional:

       - header number in the file (so once we see header 1, we can stop)

       - or; a pointer to the previous header, so we don't have to seek

      Of those, the second option is probably preferable, as it will also significantly reduce the time it takes to jump to any intermediate headers, reducing rollback time, which we want to avoid starving writer threads (among other things).

      Attachments

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

        Activity

          People

            pavlos.georgiou Pavlos Georgiou
            vesko.karaganev Vesko Karaganev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty