summaryrefslogtreecommitdiff
path: root/src/mongo/db/instance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/instance.cpp')
-rw-r--r--src/mongo/db/instance.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 93638a041dd..f103b0b1bae 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -1159,7 +1159,16 @@ void exitCleanly(ExitCode code) {
getGlobalServiceContext()->setKillAllOperations();
repl::getGlobalReplicationCoordinator()->shutdown();
- auto catalogMgr = grid.catalogManager();
+
+ Client& client = cc();
+ ServiceContext::UniqueOperationContext uniqueTxn;
+ OperationContext* txn = client.getOperationContext();
+ if (!txn) {
+ uniqueTxn = client.makeOperationContext();
+ txn = uniqueTxn.get();
+ }
+
+ auto catalogMgr = grid.catalogManager(txn);
if (catalogMgr) {
catalogMgr->shutDown();
}