Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-2958

An index deletion or collMod in the oplog can be applied to the wrong index

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 100.5.3
    • Affects Version/s: None
    • Component/s: common
    • None

      bsonutil.IsEqual() will always return true. This means that IndexCatalog.DeleteIndexes() will delete all indexes from the index catalog for a collection if there is an oplog entry that attempts to drop an index by key pattern. Thus no indexes will be built for that collection.

      IndexCatalog.collMod() will attempt to modify the first index in the index catalog for a collection if there is an oplog entry that attempts to collMod an index by key pattern.

      This was introduced as part of TOOLS-2041 in v100.4.0. These two IndexCatalog methods are the only places bsonutil.IsEqual() is used. No tools other than mongorestore are affected.

      Huge thanks to A40in on GitHub for discovering this bug: https://github.com/mongodb/mongo-tools/pull/358#issuecomment-915861493

      bsonutil.IsEqual() should be fixed. We should also make it impossible for IndexCatalog.DeleteIndexes() to delete more than one index if a single key is provided.

       

            Assignee:
            dave.rolsky@mongodb.com Dave Rolsky
            Reporter:
            tim.fogarty@mongodb.com Tim Fogarty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: