summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/active_migrations_registry.cpp
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2018-12-11 13:21:07 -0500
committerBlake Oler <blake.oler@mongodb.com>2018-12-28 00:13:08 -0500
commit84a0dd98f9bedec0d104b912f23b3a1221ae456e (patch)
treeeaea33ef45ad285977b06c9f180b748c28fc93c2 /src/mongo/db/s/active_migrations_registry.cpp
parent86b6aca9fa1940e85bba87261d1494ef2c208a4a (diff)
downloadmongo-84a0dd98f9bedec0d104b912f23b3a1221ae456e.tar.gz
SERVER-38284 Create concurrency lock for CollectionShardingRuntime
Diffstat (limited to 'src/mongo/db/s/active_migrations_registry.cpp')
-rw-r--r--src/mongo/db/s/active_migrations_registry.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/s/active_migrations_registry.cpp b/src/mongo/db/s/active_migrations_registry.cpp
index 78503d62090..6f12e0119ec 100644
--- a/src/mongo/db/s/active_migrations_registry.cpp
+++ b/src/mongo/db/s/active_migrations_registry.cpp
@@ -121,9 +121,10 @@ BSONObj ActiveMigrationsRegistry::getActiveMigrationStatusReport(OperationContex
if (nss) {
// Lock the collection so nothing changes while we're getting the migration report.
AutoGetCollection autoColl(opCtx, nss.get(), MODE_IS);
+ auto csr = CollectionShardingRuntime::get(opCtx, nss.get());
+ auto csrLock = CollectionShardingRuntimeLock::lock(opCtx, csr);
- if (auto msm =
- MigrationSourceManager::get(CollectionShardingRuntime::get(opCtx, nss.get()))) {
+ if (auto msm = MigrationSourceManager::get(csr, csrLock)) {
return msm->getMigrationStatusReport();
}
}