summaryrefslogtreecommitdiff
path: root/src/mongo/db/db.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r--src/mongo/db/db.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 94ec16df197..31477531f64 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -511,7 +511,11 @@ ExitCode _initAndListen(int listenPort) {
auto shardingInitialized = ShardingInitializationMongoD::get(startupOpCtx.get())
->initializeShardingAwarenessIfNeeded(startupOpCtx.get());
if (shardingInitialized) {
- waitForShardRegistryReload(startupOpCtx.get()).transitional_ignore();
+ auto status = waitForShardRegistryReload(startupOpCtx.get());
+ if (!status.isOK()) {
+ LOG(0) << "Failed to load the shard registry as part of startup"
+ << causedBy(redact(status));
+ }
}
auto storageEngine = serviceContext->getStorageEngine();
@@ -622,8 +626,7 @@ ExitCode _initAndListen(int listenPort) {
kind = LogicalSessionCacheServer::kReplicaSet;
}
- auto sessionCache = makeLogicalSessionCacheD(kind);
- LogicalSessionCache::set(serviceContext, std::move(sessionCache));
+ LogicalSessionCache::set(serviceContext, makeLogicalSessionCacheD(kind));
// MessageServer::run will return when exit code closes its socket and we don't need the
// operation context anymore
@@ -903,6 +906,11 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) {
balancer->waitForBalancerToStop();
}
+ // Join the logical session cache before the transport layer.
+ if (auto lsc = LogicalSessionCache::get(serviceContext)) {
+ lsc->joinOnShutDown();
+ }
+
// Shutdown the TransportLayer so that new connections aren't accepted
if (auto tl = serviceContext->getTransportLayer()) {
log(LogComponent::kNetwork) << "shutdown: going to close listening sockets...";