summaryrefslogtreecommitdiff
path: root/src/mongo/db/repair.cpp
diff options
context:
space:
mode:
authorSophia Tan <sophia_tll@hotmail.com>2022-02-03 14:09:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-03 14:54:57 +0000
commitc81c668189f7c7a933661d1e225aacfdbc33840d (patch)
tree7a650c5cb0c5ba8bf3569005d93bc1428bad1005 /src/mongo/db/repair.cpp
parent7e917657f0f23fc962010a2f2e1a837309b787ae (diff)
downloadmongo-c81c668189f7c7a933661d1e225aacfdbc33840d.tar.gz
SERVER-61987 Change DatabaseHolder's map to be keyed by TenantDatabaseName
Diffstat (limited to 'src/mongo/db/repair.cpp')
-rw-r--r--src/mongo/db/repair.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/mongo/db/repair.cpp b/src/mongo/db/repair.cpp
index 31bbc302e9d..7332440372b 100644
--- a/src/mongo/db/repair.cpp
+++ b/src/mongo/db/repair.cpp
@@ -59,6 +59,7 @@
#include "mongo/db/storage/storage_engine.h"
#include "mongo/db/storage/storage_repair_observer.h"
#include "mongo/db/storage/storage_util.h"
+#include "mongo/db/tenant_namespace.h"
#include "mongo/db/vector_clock.h"
#include "mongo/logv2/log.h"
#include "mongo/util/scopeguard.h"
@@ -128,31 +129,33 @@ Status repairCollections(OperationContext* opCtx,
} // namespace
namespace repair {
-Status repairDatabase(OperationContext* opCtx, StorageEngine* engine, const std::string& dbName) {
+Status repairDatabase(OperationContext* opCtx,
+ StorageEngine* engine,
+ const TenantDatabaseName& tenantDbName) {
DisableDocumentValidation validationDisabler(opCtx);
// We must hold some form of lock here
invariant(opCtx->lockState()->isW());
- invariant(dbName.find('.') == std::string::npos);
+ invariant(tenantDbName.dbName().find('.') == std::string::npos);
- LOGV2(21029, "repairDatabase", "db"_attr = dbName);
+ LOGV2(21029, "repairDatabase", "db"_attr = tenantDbName);
opCtx->checkForInterrupt();
// Close the db and invalidate all current users and caches.
auto databaseHolder = DatabaseHolder::get(opCtx);
- databaseHolder->close(opCtx, dbName);
+ databaseHolder->close(opCtx, tenantDbName);
// Reopening db is necessary for repairCollections.
- databaseHolder->openDb(opCtx, dbName);
+ databaseHolder->openDb(opCtx, tenantDbName);
- auto status = repairCollections(opCtx, engine, dbName);
+ auto status = repairCollections(opCtx, engine, tenantDbName.dbName());
if (!status.isOK()) {
LOGV2_FATAL_CONTINUE(21030,
"Failed to repair database {dbName}: {status_reason}",
"Failed to repair database",
- "db"_attr = dbName,
+ "db"_attr = tenantDbName,
"error"_attr = status);
}