random_ddl_crud_operations.js might miscount if a multi-shard insert races with rename

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • CAR Team 2026-08-31
    • 0
    • 🟥 DDL
    • None
    • None
    • None
    • None
    • None
    • None

      Context. SERVER-130568 made reshard use a hashed key with 10 chunks. With a sharded collection, mongos splits the unordered bulk insert across shards rather than sending it all to one.

      Problem. Drop is serialized with CRUD, but rename is not. If rename interleaves after some shards have committed their portion of the insert, the collection moves to a new name. Mongos retries the remaining batches against the old (now-empty) namespace, which implicitly recreates the collection. The post-insert count check then observes a partial document count instead of the expected all-or-nothing 0 or 60.

      Precedent. SERVER-88111 / SERVER-95758 addressed the same check for the case where mongod splits a single insert into 64-doc batches. This is the analogous problem on the mongos side: the insert is split across shards, and a mid-flight rename can leave it half-applied.

      Fix. Serialize rename with CRUD on the same collection. The same guard already applied to drop and a rename effectively drops the original nss, and it should be treated the same. 
      To not lose coverage, we could have a second test where rename an insert run concurrently, and have it built so that we can easily verify where the missing part of the batch went 

            Assignee:
            Enrico Golfieri
            Reporter:
            Enrico Golfieri
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: