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

Update mongorestore to support clustered collections

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 100.5.3
    • Affects Version/s: None
    • Component/s: mongorestore
    • Labels:

      Note that as part of this work we will temporarily disable tests with 6.0 and latest. Any task that uses those versions is failing right now because we need the shell available, but it's no longer shipped with 6.0. This will be fixed in TOOLS-3110.

      Clustered indexes are a new feature as of 5.3. See PM-2311. The "downstream visible behavior changes" section at the top of the tech design outlines the changes that impact tools: https://docs.google.com/document/d/1hRnqe1pq7ErcguJ5Bl8si1kHGKlZg0h25qsa3roASuo/edit

      A mongodump has three components:

      • metadata.json files that list the options and indexes for collections
      • .bson files that contain the data for a collection
      • an oplog.bson file that contains the oplog entries during the mongodump. We first restore the collection data then apply the oplog entries to make the data represent a consistent point in time.

      When testing indexes and collections in mongorestore, we want to test creating them from the metadata.json file as well as from oplog entries. So we want to test the following:

      • restore a clustered collection.
      • restore a create command of a clustered collection in the oplog.
      • restore a createIndexes command of a clustered index in the oplog.

      You can create a dump repo in mongorestore/testdata and use this in your tests. You probably want to do a mongodump to get what you need. Creating an oplog.bson file can be a bit more awkward. You can dump the local.oplog.rs collection directly with a --query filter to get the exact oplog entries you want.

      There are many example tests in mongorestore_test.go that you can steal from. You can base your test off of TestFixDuplicatedLegacyIndexes().

      In order for clustered indexes to work, we will probably need to add "clustered" to validIndexOptions in common/bsonutil/indexes.go.

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