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

mongod 2.4 should not start if unknown indexes present

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.10
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • ALL
    • Hide

      1. Create a 2dsphere index of version 2 in 2.6.
      2. Insert documents with new geojson fields indexed (i.e MultiPoint)
      3. Downgrade the binary to 2.4.10.
      4. Remove one of the documents with an indexed field.

      Show
      1. Create a 2dsphere index of version 2 in 2.6. 2. Insert documents with new geojson fields indexed (i.e MultiPoint) 3. Downgrade the binary to 2.4.10. 4. Remove one of the documents with an indexed field.

      Issue Status as of March 28, 2014

      ISSUE SUMMARY
      The default index format for 2dsphere and text indexes has changed between versions 2.4 and 2.6. If a user creates a 2dsphere or text index in 2.6, downgrades to 2.4, and subsequently tries to add, modify or remove an indexed document, it can corrupt the index or return incorrect results.

      USER IMPACT
      Users who downgraded from 2.6 with an existing text or 2dsphere index may corrupt these indexes or receive incorrect results when querying the corresponding collection(s).

      SOLUTION
      Run a check on startup to determine if any incompatible indexes are present, and exit if this is the case.

      WORKAROUNDS
      Users who have created a text or 2dsphere index under 2.6 and need to downgrade to 2.4 should drop the index before the downgrade, and re-create the index under 2.4.

      AFFECTED VERSIONS
      All versions from 2.4.0 to 2.4.9 are affected.

      PATCHES
      The fix is included in the 2.4.10 production release.

      Original Description

      Users who downgrade 2.6=>2.4 with a {2dsphereIndexVersion:2} index can corrupt the index and receive incorrect results from find().

      2.4 mongod should not start if the user created a {2dsphereIndexVersion:2} index in 2.6 and then tried to downgrade. Enforcement is similar to the pdfile version bump, but easier for the user to cope with (just delete the index before the downgrade).

      No change to 2.6 needed (2.6 prevents opening a collection if IndexCatalog::init() fails).

      Original description:

      2.4.10 dumps stack and refuses to unindex a geojson field of one of the new forms (i.e MultiPoint), if it recognizes that the index is version 2. However, it does this after removing the document and unindexing it from the _id index, so the 2dsphere index entry is orphaned.

      The attached script should repro.

       m27000| Wed Feb 26 13:26:20.884 [conn1] Assertion: 17289:unsupported geo index version { 2dsphereIndexVersion : 2dsphereIndexVersion: 2 }, only support versions: [1]
       m27000| 0x10044f20b 0x100428bbe 0x100428c7d 0x1001c38e0 0x1001e46c2 0x1001d4426 0x1001dadcf 0x1001db519 0x1001d7356 0x1001d7474 0x1001df1ef 0x1001df932 0x1002667f8 0x100266a04 0x10023d4e8 0x1001ed7ca 0x1001f15e2 0x10000b8d2 0x100444bd9 0x100481da5
       m27000|  0   mongod-2.4.10                       0x000000010044f20b _ZN5mongo15printStackTraceERSo + 43
       m27000|  1   mongod-2.4.10                       0x0000000100428bbe _ZN5mongo11msgassertedEiPKc + 174
       m27000|  2   mongod-2.4.10                       0x0000000100428c7d _ZN5mongo11msgassertedEiRKSs + 29
       m27000|  3   mongod-2.4.10                       0x00000001001c38e0 _ZNK5mongo13S2IndexPlugin8generateEPKNS_9IndexSpecE + 1004
       m27000|  4   mongod-2.4.10                       0x00000001001e46c2 _ZN5mongo9IndexSpec5_initENS0_11PluginRulesE + 3532
       m27000|  5   mongod-2.4.10                       0x00000001001d4426 _ZN5mongo9IndexSpec5resetERKNS_7BSONObjENS0_11PluginRulesE + 434
       m27000|  6   mongod-2.4.10                       0x00000001001dadcf _ZN5mongo9IndexSpec5resetERKNS_7DiskLocENS0_11PluginRulesE + 77
       m27000|  7   mongod-2.4.10                       0x00000001001db519 _ZN5mongo25NamespaceDetailsTransient12getIndexSpecEPKNS_12IndexDetailsE + 219
       m27000|  8   mongod-2.4.10                       0x00000001001d7356 _ZNK5mongo12IndexDetails7getSpecEv + 224
       m27000|  9   mongod-2.4.10                       0x00000001001d7474 _ZNK5mongo12IndexDetails17getKeysFromObjectERKNS_7BSONObjERSt3setIS1_NS_10BSONObjCmpESaIS1_EE + 18
       m27000|  10  mongod-2.4.10                       0x00000001001df1ef _ZN5mongoL14_unindexRecordERNS_12IndexDetailsERNS_7BSONObjERKNS_7DiskLocEb + 143
       m27000|  11  mongod-2.4.10                       0x00000001001df932 _ZN5mongo13unindexRecordEPNS_16NamespaceDetailsEPNS_6RecordERKNS_7DiskLocEb + 114
       m27000|  12  mongod-2.4.10                       0x00000001002667f8 _ZN5mongo11DataFileMgr12deleteRecordEPNS_16NamespaceDetailsEPKcPNS_6RecordERKNS_7DiskLocEbbb + 526
       m27000|  13  mongod-2.4.10                       0x0000000100266a04 _ZN5mongo11DataFileMgr12deleteRecordEPKcPNS_6RecordERKNS_7DiskLocEbbb + 150
       m27000|  14  mongod-2.4.10                       0x000000010023d4e8 _ZN5mongo13deleteObjectsEPKcNS_7BSONObjEbbbPNS_11RemoveSaverE + 3128
       m27000|  15  mongod-2.4.10                       0x00000001001ed7ca _ZN5mongo14receivedDeleteERNS_7MessageERNS_5CurOpE + 1114
       m27000|  16  mongod-2.4.10                       0x00000001001f15e2 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 6210
       m27000|  17  mongod-2.4.10                       0x000000010000b8d2 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 198
       m27000|  18  mongod-2.4.10                       0x0000000100444bd9 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1657
       m27000|  19  mongod-2.4.10                       0x0000000100481da5 thread_proxy + 229
       m27000| Wed Feb 26 13:26:20.892 [conn1] remove geoDB.geoColl query: { _id: "multipoint0" } keyUpdates:0 exception: unsupported geo index version { 2dsphereIndexVersion : 2dsphereIndexVersion: 2 }, only support versions: [1] code:17289 locks(micros) w:8542 7ms
      

        1. downgrade_with_version_2_index.js
          2 kB
          sam.helman@10gen.com

            Assignee:
            rassi J Rassi
            Reporter:
            sam.helman@10gen.com sam.helman@10gen.com
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: