summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/mr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/commands/mr.cpp')
-rw-r--r--src/mongo/db/commands/mr.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 6d3ad0e9a50..6a09c83bbc0 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -108,7 +108,8 @@ unsigned long long collectionCount(OperationContext* opCtx,
// If the global write lock is held, we must avoid using AutoGetCollectionForReadCommand as it
// may lead to deadlock when waiting for a majority snapshot to be committed. See SERVER-24596.
if (callerHoldsGlobalLock) {
- Database* db = DatabaseHolder::getDatabaseHolder().get(opCtx, nss.ns());
+ auto databaseHolder = DatabaseHolder::get(opCtx);
+ auto db = databaseHolder->getDb(opCtx, nss.ns());
if (db) {
coll = db->getCollection(opCtx, nss);
}
@@ -467,8 +468,8 @@ void State::dropTempCollections() {
if (_useIncremental && !_config.incLong.isEmpty()) {
writeConflictRetry(_opCtx, "M/R dropTempCollections", _config.incLong.ns(), [this] {
Lock::DBLock lk(_opCtx, _config.incLong.db(), MODE_X);
- if (Database* db =
- DatabaseHolder::getDatabaseHolder().get(_opCtx, _config.incLong.ns())) {
+ auto databaseHolder = DatabaseHolder::get(_opCtx);
+ if (auto db = databaseHolder->getDb(_opCtx, _config.incLong.ns())) {
WriteUnitOfWork wunit(_opCtx);
uassertStatusOK(db->dropCollection(_opCtx, _config.incLong.ns()));
wunit.commit();