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

Mongorestore incorrectly converts small negative float64 index keys to 1 instead of -1

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Tools and Replicator
    • 5
    • 1,305

      Problem

      Mongorestore converts legacy index specs to prevent index creations on the source from erroring. For example, a legacy index (that persisted across upgrades) may have an index key value of 0. 3.4+ server versions no longer allow index key values of 0.

      It currently incorrectly converts an index key value less than -1 x 10^9 to 1 (ascending). The server treats these legacy index keys as -1 (descending).

      (see mongorestore's risk assessment.)

      Solution & Acceptance Criteria

      Mongorestore convertLegacyIndexes function should only convert float64s >= 0 to 1.

      From the IA:

      Support upgrading index specifications from pre-3.4 to 3.4+ server versions correctly. To achieve this we need to do the following for mongosync/mongorestore/mongomirror:

      • Check the index version before converting and only convert pre-v2 indexes.
      • Fix the known issue in all tools, only convert 0 values of float64 to 1. Mongomirror is importing the bsonutil package from mongo-tools. We will fix it in mongo-tools first and then update the import in mongomirror, and do a new release of the Database Tools (TOOLS-3714) and mongomirror (MGOMIRROR-542). This fix will also be included in mongosync 1.10 release.

      Confirm that legacy index key conversion implemented in our tools is correct after the above fix. To achieve this, we will need to reference the internal documentation and restrict legacy index key conversions to only support specific index version upgrades that are documented and tested in SERVER-96766.

      Impact

      This bug can cause a legacy index with key less than -1 x 10^9 on the source to be built with key: 1 on the destination. This means that the destination cluster will treat the index as ascending while the source treats it as descending. This can cause unexpected performance issues for users.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jian.guan@mongodb.com Jian Guan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: