From 9586e557d54ef70f9ca4b43c26892cd55257e1a5 Mon Sep 17 00:00:00 2001 From: Blake Oler Date: Fri, 16 Feb 2018 16:50:58 -0500 Subject: Revert "SERVER-32677 Fix segmentation fault when converting a replica set to a replicated sharded cluster" This reverts commit cad0d35091f98b5c2bb37765861841844bd9e16d. --- src/mongo/db/SConscript | 1 - src/mongo/db/db.cpp | 11 ++--------- src/mongo/db/s/sharding_initialization_mongod.cpp | 18 +----------------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index 8b106e1dba3..5abc22b68df 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -585,7 +585,6 @@ env.Library( ], LIBDEPS=[ '$BUILD_DIR/mongo/base', - '$BUILD_DIR/mongo/db/logical_session_cache_factory_mongod', '$BUILD_DIR/mongo/transport/service_entry_point', 'auth/authmongod', 'commands/dcommands_fsync', diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index d46545f50be..ec05dcf5233 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -999,7 +999,6 @@ ExitCode _initAndListen(int listenPort) { // Set up the logical session cache LogicalSessionCacheServer kind = LogicalSessionCacheServer::kStandalone; - if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { kind = LogicalSessionCacheServer::kSharded; } else if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { @@ -1008,14 +1007,8 @@ ExitCode _initAndListen(int listenPort) { kind = LogicalSessionCacheServer::kReplicaSet; } - // Shards and config servers set up the LogicalSessionCache when they go through sharding - // state initialization - if (kind == LogicalSessionCacheServer::kStandalone || - kind == LogicalSessionCacheServer::kReplicaSet) { - invariant(LogicalSessionCache::get(startupOpCtx.get()) == nullptr); - auto sessionCache = makeLogicalSessionCacheD(serviceContext, kind); - LogicalSessionCache::set(serviceContext, std::move(sessionCache)); - } + auto sessionCache = makeLogicalSessionCacheD(serviceContext, kind); + LogicalSessionCache::set(serviceContext, std::move(sessionCache)); // MessageServer::run will return when exit code closes its socket and we don't need the // operation context anymore diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp index 33699f32919..bccdebf8f21 100644 --- a/src/mongo/db/s/sharding_initialization_mongod.cpp +++ b/src/mongo/db/s/sharding_initialization_mongod.cpp @@ -36,8 +36,6 @@ #include "mongo/client/connection_string.h" #include "mongo/client/remote_command_targeter.h" #include "mongo/client/remote_command_targeter_factory_impl.h" -#include "mongo/db/logical_session_cache.h" -#include "mongo/db/logical_session_cache_factory_mongod.h" #include "mongo/db/logical_time_metadata_hook.h" #include "mongo/db/logical_time_validator.h" #include "mongo/db/operation_context.h" @@ -109,7 +107,7 @@ Status initializeGlobalShardingStateForMongod(OperationContext* opCtx, validator->resetKeyManager(); } - auto initializeStatus = initializeGlobalShardingState( + return initializeGlobalShardingState( opCtx, configCS, distLockProcessId, @@ -126,20 +124,6 @@ Status initializeGlobalShardingStateForMongod(OperationContext* opCtx, // We only need one task executor here because sharding task executors aren't used for user // queries in mongod. 1); - - if (!initializeStatus.isOK()) { - return initializeStatus; - } - - const auto serverType = serverGlobalParams.clusterRole == ClusterRole::ConfigServer - ? LogicalSessionCacheServer::kConfigServer - : LogicalSessionCacheServer::kSharded; - - invariant(LogicalSessionCache::get(opCtx) == nullptr); - auto sessionCache = makeLogicalSessionCacheD(opCtx->getServiceContext(), serverType); - LogicalSessionCache::set(opCtx->getServiceContext(), std::move(sessionCache)); - - return Status::OK(); } } // namespace mongo -- cgit v1.2.1