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

Cbtransfer from couchstore files is potentially broken on buckets created pre-4.6

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 5.1.0
    • 4.6.0, 4.6.1, 4.6.4, 4.6.2, 4.6.3, 5.0.0, 5.0.1, 5.5.0
    • tools
    • Untriaged
    • Unknown

    Description

      MB-22036 fixed an issue where there were fewer number of bytes in the rev_meta than expected, due to the removal of the conflict resolution bytes.

      This works fine (and I assume this is what was tested) for buckets created after 4.6 (and later) has been installed.
      However, there is also the second case where a bucket was created on a version prior to upgrade, for example in 4.5.1 and each item has the conflict resolution byte stored in the couchstore file.

      Upon upgrade to 4.6, this byte is not removed from each item in the couchstore file, even during a compaction.
      However, this byte is removed if an item is created/updated, as the new version of the item has to be written to disk.

      Before:

      Dumping "/opt/couchbase/var/lib/couchbase/data/travel-sample/361.couch.2":
        Doc ID: airline_10
           seq: 35
           rev: 2
           content_meta: 128
           size (on disk): 136
           cas: 1514373993187639296, expiry: 0, flags: 0, datatype: 1, conflict_resolution_mode: 0
           size: 150
           data: (snappy) {
        "id": 10,
        "type": "airline",
        "name": "40-Mile Air",
        "iata": "Q5",
        "icao": "MLA",
        "callsign": "MILE-AIR",
        "country": "United States"
      }
      

      After:

      Dumping "/opt/couchbase/var/lib/couchbase/data/travel-sample/361.couch.2":
        Doc ID: airline_10
           seq: 35
           rev: 2
           content_meta: 128
           size (on disk): 137
           cas: 1514373993187639296, expiry: 0, flags: 0, datatype: 1
           size: 150
           data: (snappy) {
        "id": 10,
        "type": "airline",
        "name": "40-Mile Aira",
        "iata": "Q5",
        "icao": "MLA",
        "callsign": "MILE-AIR",
        "country": "United States"
      }
      

      New Item:

      Dumping "/opt/couchbase/var/lib/couchbase/data/travel-sample/687.couch.2":
        Doc ID: new_boy
           seq: 40
           rev: 1
           content_meta: 128
           size (on disk): 78
           cas: 1514373893742592000, expiry: 0, flags: 0, datatype: 1
           size: 67
           data: (snappy) {"click":"to edit","with JSON":"there are no reserved field names"}
      

      The net-result of this for cbtransfer is that cbtransfer will error out with the following message if items exist with the conflict resolution byte:

      error: could not read couchstore file due to unsupported file format version; exception: unpack requires a string argument of length 18
      

      Instead we should try to load the metadata in using 18 bytes, and if that fails then try a second time with 19 bytes (including conflict resolution flag). Since we cannot make any guarantees that an item will match one format or the other.

      Attachments

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

        Activity

          People

            thuan Thuan Nguyen
            matt.carabine Matt Carabine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty