summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Fuschetto <antonio.fuschetto@mongodb.com>2023-05-15 13:30:45 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-15 15:25:49 +0000
commitd97d54d03959846dd4294c811fe89fb91d7a9d89 (patch)
tree75d5cd1c582627760002453d1523befb8ed12516
parent572a0c3987787a66f0192009b30651b8bae822ff (diff)
downloadmongo-d97d54d03959846dd4294c811fe89fb91d7a9d89.tar.gz
SERVER-76983 Shutdown and join the CatalogCached's thread pool when mongos terminates
-rw-r--r--src/mongo/s/mongos_main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/s/mongos_main.cpp b/src/mongo/s/mongos_main.cpp
index 4e8f3f329a9..8f0a4f7758b 100644
--- a/src/mongo/s/mongos_main.cpp
+++ b/src/mongo/s/mongos_main.cpp
@@ -366,6 +366,7 @@ void cleanupTask(const ShutdownTaskArgs& shutdownArgs) {
}
if (auto pool = Grid::get(opCtx)->getExecutorPool()) {
+ LOGV2_OPTIONS(7698300, {LogComponent::kSharding}, "Shutting down the ExecutorPool");
pool->shutdownAndJoin();
}
@@ -374,6 +375,13 @@ void cleanupTask(const ShutdownTaskArgs& shutdownArgs) {
}
if (Grid::get(serviceContext)->isShardingInitialized()) {
+ // The CatalogCache must be shuted down before shutting down the CatalogCacheLoader as
+ // the CatalogCache may try to schedule work on CatalogCacheLoader and fail.
+ LOGV2_OPTIONS(7698301, {LogComponent::kSharding}, "Shutting down the CatalogCache");
+ Grid::get(serviceContext)->catalogCache()->shutDownAndJoin();
+
+ LOGV2_OPTIONS(
+ 7698302, {LogComponent::kSharding}, "Shutting down the CatalogCacheLoader");
CatalogCacheLoader::get(serviceContext).shutDown();
}