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

Sharding an empty collection releases the critical section too early

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc0, 5.0.9
    • Affects Version/s: 5.0.5, 5.1.1, 5.2.1, 5.3.0-rc4
    • Component/s: Sharding
    • Labels:
    • Fully Compatible
    • ALL
    • v5.0
    • Sharding EMEA 2022-04-04, Sharding EMEA 2022-04-18

      When we shard an empty collection we can take a shortcut and create chunks on shards different from the DB primary. This needs to happen under the critical section so that we don't accept writes to the empty collection, before we have actually told the DB primary to no longer accept unsharded writes.

      The bug that we have is that we release the critical section after we have made the newly sharded collection visible, but before we set the shard version on the DB primary for that collection.

      This means that there is a brief window during which writes for an empty collection that was just sharded could be accepted.

            kaloian.manassiev@mongodb.com Kaloian Manassiev
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            0 Vote for this issue
            7 Start watching this issue