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

couchstore can rollback from a header without logging it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • bug-backlog
    • 3.1.5, 4.1.1, 4.5.0, 5.0.0
    • storage-engine
    • None
    • Untriaged
    • No

    Description

      If couchstore encounters an invalid header while opening a file it will potentially rollback, find a valid header, continue along and report success. This could potentially result in dataloss without it being logged anywhere.

      1
      static couchstore_error_t find_header(Db *db, int64_t start_pos)
      2
      {
      3
          couchstore_error_t last_header_errcode = COUCHSTORE_ERROR_NO_HEADER;
      4
          int64_t pos = start_pos;
      5
          pos -= pos % COUCH_BLOCK_SIZE;
      6
          for (; pos >= 0; pos -= COUCH_BLOCK_SIZE) {
      7
              couchstore_error_t errcode = find_header_at_pos(db, pos);
      8
              switch(errcode) {
      9
                  case COUCHSTORE_SUCCESS:
      10
                      // Found it!
      11
                      return COUCHSTORE_SUCCESS;
      12
                  case COUCHSTORE_ERROR_NO_HEADER:
      13
                      // No header here, so keep going
      14
                      break;
      15
                  case COUCHSTORE_ERROR_ALLOC_FAIL:
      16
                      // Fatal error
      17
                      return errcode;
      18
                  default:
      19
                      // Invalid header; continue, but remember the last error
      20
                      last_header_errcode = errcode;
      21
                      break;
      22
              }
      23
          }
      24
          return last_header_errcode;
      25
      }
      

      Attachments

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

        Activity

          People

            srinath.duvuru Srinath Duvuru
            will.gardner Will Gardner (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty