diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-05-03 16:21:24 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-05-09 07:40:56 -0400 |
commit | 2791817876636c0cfd60d867f31c7a83cf3f18c1 (patch) | |
tree | 3aefcb1999cccf4cb53b2401a44857549ba8722a /src/mongo/s/server.cpp | |
parent | 1b8a9f5dc5c3314042b55e7415a2a25045b32a94 (diff) | |
download | mongo-2791817876636c0cfd60d867f31c7a83cf3f18c1.tar.gz |
SERVER-37837 Get rid of TransactionReaper (Part 1)
This change gets rid of the TransactionReaper's usage of the
ReplicationCoordinator for checking whether it is primary or not and
makes the LogicalSessionCache joinable on shutdown.
It also removes the TransactionReaper's grouping per-shard optimization
and moves it all under SessionCollectionSharded.
Diffstat (limited to 'src/mongo/s/server.cpp')
-rw-r--r-- | src/mongo/s/server.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 29c490ba8b0..6580faeb0c5 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -55,13 +55,15 @@ #include "mongo/db/lasterror.h" #include "mongo/db/log_process_details.h" #include "mongo/db/logical_clock.h" -#include "mongo/db/logical_session_cache_factory_mongos.h" +#include "mongo/db/logical_session_cache_impl.h" #include "mongo/db/logical_time_metadata_hook.h" #include "mongo/db/logical_time_validator.h" #include "mongo/db/operation_context.h" #include "mongo/db/server_options.h" #include "mongo/db/service_context.h" +#include "mongo/db/service_liaison_mongos.h" #include "mongo/db/session_killer.h" +#include "mongo/db/sessions_collection_sharded.h" #include "mongo/db/startup_warnings_common.h" #include "mongo/db/wire_version.h" #include "mongo/executor/task_executor_pool.h" @@ -84,7 +86,6 @@ #include "mongo/s/query/cluster_cursor_manager.h" #include "mongo/s/service_entry_point_mongos.h" #include "mongo/s/sharding_egress_metadata_hook_for_mongos.h" -#include "mongo/s/sharding_egress_metadata_hook_for_mongos.h" #include "mongo/s/sharding_initialization.h" #include "mongo/s/sharding_uptime_reporter.h" #include "mongo/s/version_mongos.h" @@ -187,6 +188,9 @@ void cleanupTask(ServiceContext* serviceContext) { Client::initThread(getThreadName()); Client& client = cc(); + // Join the logical session cache before the transport layer + LogicalSessionCache::get(serviceContext)->joinOnShutDown(); + // Shutdown the TransportLayer so that new connections aren't accepted if (auto tl = serviceContext->getTransportLayer()) { log(LogComponent::kNetwork) << "shutdown: going to close all sockets..."; @@ -496,8 +500,13 @@ ExitCode runMongosServer(ServiceContext* serviceContext) { SessionKiller::set(serviceContext, std::make_shared<SessionKiller>(serviceContext, killSessionsRemote)); - // Set up the logical session cache - LogicalSessionCache::set(serviceContext, makeLogicalSessionCacheS()); + LogicalSessionCache::set(serviceContext, + stdx::make_unique<LogicalSessionCacheImpl>( + stdx::make_unique<ServiceLiaisonMongos>(), + stdx::make_unique<SessionsCollectionSharded>(), + [](OperationContext*, SessionsCollection&, Date_t) { + return 0; /* No op*/ + })); status = serviceContext->getServiceExecutor()->start(); if (!status.isOK()) { |