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

Lock-free acquisitions can read from sharded collection as unsharded when collection is dropped and recreated (ABA problem)

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Catalog and Routing
    • ALL

      This is hypothetical, we haven't tried to reproduce it.

      The scenario looks like this:

      1. Collection exists and is unsharded.
      2. Mongos attaches shard version UNSHARDED to the request.
      3. acquireCollectionWithoutLocks checksShardingPlacement, it is correct.
      4. Collection becomes sharded from some other client running shardCollection.
      5. acquireCollectionWithoutLocks opens the snapshot at this point.
      6. Collection is dropped from some other client running drop.
      7. Collection is created again as unsharded from some other client running create.
      8. acquireCollectionWithoutLocks checksShardingPlacement again and everything checks out because the request was sent with shard version UNSHARDED and the collection is (again now) unsharded.

      Currently we have a check to prevent this exact scenario described in SERVER-62457 in the AutoGetCollectionForLockFreeReads case, however it might be broken, see SERVER-76559.

            Assignee:
            backlog-server-catalog-and-routing [DO NOT USE] Backlog - Catalog and Routing
            Reporter:
            daniel.gomezferro@mongodb.com Daniel Gomez Ferro
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: