Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-24275

enableBSON1_1 server parameter doesn't control whether KeyString v1 index is built or not

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.8
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide
      1. Start version 3.3.6 of mongod with --setParameter="enableBSON1_1=false".
      2. Shut down the mongod.
      3. Start version 3.2.6 of mongod on the same data directory.
      2016-05-24T12:52:02.153-0400 I -        [initandlisten] Fatal assertion 28579 UnsupportedFormat: Application metadata for table:index-1--6305025376839485705 has unsupported format version 7
      2016-05-24T12:52:02.153-0400 I -        [initandlisten] 
      
      ***aborting after fassert() failure
      
      Show
      Start version 3.3.6 of mongod with --setParameter="enableBSON1_1=false" . Shut down the mongod. Start version 3.2.6 of mongod on the same data directory. 2016-05-24T12:52:02.153-0400 I - [initandlisten] Fatal assertion 28579 UnsupportedFormat: Application metadata for table:index-1--6305025376839485705 has unsupported format version 7 2016-05-24T12:52:02.153-0400 I - [initandlisten] ***aborting after fassert() failure
    • Query 15 (06/03/16)

      This prevents testing upgrade/downgrade between MongoDB 3.4 and MongoDB 3.2 without first dropping all collections and indexes that were created in MongoDB 3.4. If KeyString v1 is supposed to be separate from BSON 1.1 (i.e. the decimal data type), then having an additional server parameter to configure kCurrentIndexVersion seems desirable.

      One idea for patching this issue
      Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
      index c0b04a4..7a2ef04 100644
      --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
      +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp
      @@ -82,14 +82,10 @@ static const int TempKeyMaxSize = 1024;  // this goes away with SERVER-3372
       
       static const WiredTigerItem emptyItem(NULL, 0);
       
      +static const int kKeyStringV0Version = 6;
       static const int kKeyStringV1Version = 7;
      -static const int kMinimumIndexVersion = 6;
      -static const int kCurrentIndexVersion = kKeyStringV1Version;  // New indexes use this by default.
      +static const int kMinimumIndexVersion = kKeyStringV0Version;
       static const int kMaximumIndexVersion = kKeyStringV1Version;
      -static_assert(kCurrentIndexVersion >= kMinimumIndexVersion,
      -              "kCurrentIndexVersion >= kMinimumIndexVersion");
      -static_assert(kCurrentIndexVersion <= kMaximumIndexVersion,
      -              "kCurrentIndexVersion <= kMaximumIndexVersion");
       
       bool hasFieldNames(const BSONObj& obj) {
           BSONForEach(e, obj) {
      @@ -198,7 +194,7 @@ StatusWith<std::string> WiredTigerIndex::generateCreateString(const std::string&
       
           // Index metadata
           ss << ",app_metadata=("
      -       << "formatVersion=" << (enableBSON1_1 ? kKeyStringV1Version : kCurrentIndexVersion) << ','
      +       << "formatVersion=" << (enableBSON1_1 ? kKeyStringV1Version : kKeyStringV0Version) << ','
              << "infoObj=" << desc.infoObj().jsonString() << "),";
       
           LOG(3) << "index create string: " << ss.ss.str();
      

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: