summaryrefslogtreecommitdiff
path: root/src/mongo/db/repair_database.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-12-20 23:34:46 -0500
committerBenety Goh <benety@mongodb.com>2018-12-20 23:35:03 -0500
commit4270e87c62a2c7ea365b20bb37ede7e3888ad0ed (patch)
tree2d5b891bb3934dfaa09e87d3294a7653e401b7d1 /src/mongo/db/repair_database.cpp
parent3c140cdd63bbf20e585bbbccd21ed3ea64e656b1 (diff)
downloadmongo-4270e87c62a2c7ea365b20bb37ede7e3888ad0ed.tar.gz
SERVER-38719 rename DatabaseHolder::get() to getDb()
Repurpose DatabaseHolder::get() for accessing singleton. Deprecate DatabaseHolder::getDatabaseHolder().
Diffstat (limited to 'src/mongo/db/repair_database.cpp')
-rw-r--r--src/mongo/db/repair_database.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp
index 39766594f89..abbb2e94b6f 100644
--- a/src/mongo/db/repair_database.cpp
+++ b/src/mongo/db/repair_database.cpp
@@ -121,8 +121,6 @@ Status rebuildIndexesOnCollection(OperationContext* opCtx,
if (indexSpecs.empty())
return Status::OK();
- auto dbHolder = &DatabaseHolder::getDatabaseHolder();
-
const auto& ns = cce->ns().ns();
auto rs = dbce->getRecordStore(ns);
@@ -149,7 +147,8 @@ Status rebuildIndexesOnCollection(OperationContext* opCtx,
// open a bad index and fail.
// TODO see if MultiIndexBlock can be made to work without a Collection.
const auto uuid = cce->getCollectionOptions(opCtx).uuid;
- collection = dbHolder->makeCollection(opCtx, ns, uuid, cce, rs, dbce);
+ auto databaseHolder = DatabaseHolder::get(opCtx);
+ collection = databaseHolder->makeCollection(opCtx, ns, uuid, cce, rs, dbce);
indexer = std::make_unique<MultiIndexBlock>(opCtx, collection.get());
Status status = indexer->init(indexSpecs).getStatus();
@@ -280,14 +279,15 @@ Status repairDatabase(OperationContext* opCtx, StorageEngine* engine, const std:
opCtx->checkForInterrupt();
// Close the db and invalidate all current users and caches.
- DatabaseHolder::getDatabaseHolder().close(opCtx, dbName, "database closed for repair");
- ON_BLOCK_EXIT([&dbName, &opCtx] {
+ auto databaseHolder = DatabaseHolder::get(opCtx);
+ databaseHolder->close(opCtx, dbName, "database closed for repair");
+ ON_BLOCK_EXIT([databaseHolder, &dbName, &opCtx] {
try {
// Ensure that we don't trigger an exception when attempting to take locks.
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
// Open the db after everything finishes.
- auto db = DatabaseHolder::getDatabaseHolder().openDb(opCtx, dbName);
+ auto db = databaseHolder->openDb(opCtx, dbName);
// Set the minimum snapshot for all Collections in this db. This ensures that readers
// using majority readConcern level can only use the collections after their repaired