Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1179

Query chunks filtering by 'uuid' or 'ns' according to metadata format

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.8.0
    • Affects Version/s: None
    • Component/s: sh
    • Iteration Ragfish, Iteration Seahorse, Iteration Unicornfish, Iteration Velvet Crab
    • Not Needed

      On version 5.0 the config.chunks document format was changed (SERVER-53105). Before, the chunk documents had a 'ns' field (and index) that allowed joining with config.collections. After SERVER-53105, chunks have a 'uuid' field (and index) that also allows joining with config.collections and no longer have 'ns'.
      Mongosh's sh.status() and getShardDisbribution() query config.chunks to find all chunks belonging to a collection. To Support both config.chunks format, an '$or: [ns, uuid]' filter was built (MONGOSH-740). This is correct, but it is not performant because it will need to COLLSCAN – either the uuid index exists, or the ns index exists, but not both at the same time.

      This can be addressed if mongosh is made to query chunks like the legacy shell does (SERVER-56875): Look for the corresponding config.collections entry. If it has a 'timestamp' field, then chunks have the new format and should be queried by 'uuid'; otherwise query by 'ns'. This will always make use of an index.

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: