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

[v5.0] Chunk split commit precondition must correctly target indexed field

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • 5.0 Required
    • Affects Version/s: 5.0.0
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • CAR Team 2025-02-03

      When upgrading the FCV from v4.4 to v5.0, the internal format of config.chunks and config.collections  documents is updated following those steps:

      1. Add uuid and timestamp fields to config.chunks documents
      2. Create uuid-related indexes
      3. Add timestamp to config.collection documents
      4. Remove the nss field from config.chunks documents

      Because of upgrade order, when working with chunk documents the recurring pattern to support both old and new chunks format is the following:

      if(timestamp set on config.collections)
         queries target chunks via uuid
      else
         queries target chunks via namespace

      This is correct because the presence of a timestamp in config.collections (added at step 3) guarantees the existence of an index on the uuid field (created at step 2). For example, this pattern is implemented in the chunk merge commit path.

      There is one specific snippet in the chunk split commit path that mistakenly implemented a slightly different pattern:

      if(timestamp set on the config.chunks document to split)
          target chunk via uuid
      else
          target chunk via namespace 

      This is incorrect because the presence of a timestamp in config.chunks (added at step 1) does not guarantee the existence of an index on the uuid field (created at step 2).

      The consequence is that when a chunk split operation commits between (1) and (3), it is highly probable for the change to result in a COLLSCAN.

      Purpose of this ticket is to implement the right pattern also in the split commit path.

            Assignee:
            pierlauro.sciarelli@mongodb.com Pierlauro Sciarelli
            Reporter:
            pierlauro.sciarelli@mongodb.com Pierlauro Sciarelli
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: