summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/migration_source_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/migration_source_manager.cpp')
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index d0973fd57d3..5031490ba21 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -449,7 +449,7 @@ Status MigrationSourceManager::commitChunkMetadataOnConfig(OperationContext* opC
// this node can accept writes for this collection as a proxy for it being primary.
if (!status.isOK()) {
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_IX);
+ AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_X);
if (!repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, getNss())) {
CollectionShardingRuntime::get(opCtx, getNss())->clearFilteringMetadata();
uassertStatusOK(status.withContext(
@@ -485,7 +485,7 @@ Status MigrationSourceManager::commitChunkMetadataOnConfig(OperationContext* opC
if (!refreshStatus.isOK()) {
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_IX);
+ AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_X);
CollectionShardingRuntime::get(opCtx, getNss())->clearFilteringMetadata();
@@ -684,19 +684,18 @@ void MigrationSourceManager::_cleanup(OperationContext* opCtx) {
auto cloneDriver = [&]() {
// Unregister from the collection's sharding state and exit the migration critical section.
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_IX);
- auto* const csr = CollectionShardingRuntime::get(opCtx, getNss());
- auto csrLock = CollectionShardingRuntimeLock::lockExclusive(opCtx, csr);
+ AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_X);
+ auto* const css = CollectionShardingRuntime::get(opCtx, getNss());
// In the kCreated state there should be no state to clean up, but we can verify this
// just to be safe.
if (_state == kCreated) {
// Verify that we did not set the MSM on the CSR.
- invariant(!msmForCsr(csr));
+ invariant(!msmForCsr(css));
// Verify that the clone driver was not initialized.
invariant(!_cloneDriver);
} else {
- auto oldMsmOnCsr = std::exchange(msmForCsr(csr), nullptr);
+ auto oldMsmOnCsr = std::exchange(msmForCsr(css), nullptr);
invariant(this == oldMsmOnCsr);
}
_critSec.reset();