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

The slow 'shardCollection' path performs heavy work under the critical section

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0, 5.0.4, 5.1.0-rc1
    • Affects Version/s: 5.0.3, 5.1.0-rc0
    • Component/s: None
    • None
    • Fully Compatible
    • v5.1, v5.0
    • Sharding EMEA 2021-10-18

      As part of the "Robust DDL" changes (PM-1965), the amount of work which shardCollection does under the critical section has increased from 4.4 to 5.0 and this leads to writes being blocked for longer time than necessary:

      For more context, if a collection is being sharded and we discover that that collection is empty (has zero documents), we hold the critical section for the entire duration (index creation, chunks creation, etc.) in order to ensure that no writes come in case we are creating chunks on shards other than the primary.

      However, if we discover that the collection has documents, we can only create chunks locally and therefore we can allow writes to proceed because they will always be searching on the primary shard.

      As part of this ticket we should do the absolutely minimum amount of work under the critical section, as part of the optimised path.

            Assignee:
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: