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

MigrationChunkClonerSourceOpObserver::onBatchedWriteCommit violates dassert when accessing CollectionShardingState

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: 8.0.0
    • Component/s: None
    • None
    • Replication
    • Fully Compatible
    • ALL
    • Repl 2024-10-28, Repl 2024-11-11
    • 200

      MigrationChunkClonerSourceOpObserver::onBatchedWriteCommit installs an onCommit handler LogRetryableApplyOpsForShardingHandler, passing the list of TransactionParticipant's affectedNamespaces to its constructor. Later, when the handler executes, for each of these namespaces it will get the CollectionShardingState associated to it by calling CollectionShardingRuntime::assertCollectionLockedAndAcquireShared. assertCollectionLockedAndAcquireShared has a dassert that states that the collection lock for that namespace should be held in at least IX mode by this opCtx.

      However, this assertion does not hold true in all situations. An example of a violation is a bulkWrite affecting two different collections: In this case, the first write in the bulkWrite batch will add collectionA to the TransactionParticipant's affectedNamespaces, and later the following writes in that same bulkWrite will observe the first collection in the affectedNamespaces but the locks for it won't be held.

            Assignee:
            sean.zimmerman@mongodb.com Sean Zimmerman
            Reporter:
            jordi.serra-torrens@mongodb.com Jordi Serra Torrens
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: