mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-34211 restore cached oplog pointer if restartCatalog exits early
This commit is contained in:
parent
3d8e10a123
commit
50bb9fd6ff
@ -105,9 +105,21 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
auto restoreOplogPointerGuard = MakeGuard([opCtx]() {
|
||||
auto db = DatabaseHolder::getDatabaseHolder().openDb(
|
||||
opCtx, NamespaceString::kRsOplogNamespace.db());
|
||||
invariant(db, "failed to reopen database after early exit from restartCatalog");
|
||||
|
||||
auto oplog = db->getCollection(opCtx, NamespaceString::kRsOplogNamespace.coll());
|
||||
invariant(oplog, "failed to get oplog after early exit from restartCatalog");
|
||||
repl::establishOplogCollectionForLogging(opCtx, oplog);
|
||||
});
|
||||
|
||||
log() << "Closing database catalog";
|
||||
catalog::closeCatalog(opCtx);
|
||||
|
||||
restoreOplogPointerGuard.Dismiss();
|
||||
|
||||
log() << "Reopening database catalog";
|
||||
catalog::openCatalog(opCtx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user