diff options
author | William Schultz <william.schultz@mongodb.com> | 2020-02-07 20:17:18 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-08 01:29:37 +0000 |
commit | 4ae67479e73174a75f2d7141360edb8a8ef90be8 (patch) | |
tree | 92a9ecc6a47e1dd201a8fc579700f74f0d8c8842 /src/mongo/db/s/sharding_initialization_mongod.cpp | |
parent | 80321ac758befea3afd579572575ab91f6bb9e9e (diff) | |
download | mongo-4ae67479e73174a75f2d7141360edb8a8ef90be8.tar.gz |
Revert "SERVER-44771 Introduce 2nd CatalogCache for filtering only"
This reverts commit 3473d09fa9b5e418e119941b01c88863744689cc.
Diffstat (limited to 'src/mongo/db/s/sharding_initialization_mongod.cpp')
-rw-r--r-- | src/mongo/db/s/sharding_initialization_mongod.cpp | 53 |
1 files changed, 11 insertions, 42 deletions
diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp index 24100e2d682..7c81c06766c 100644 --- a/src/mongo/db/s/sharding_initialization_mongod.cpp +++ b/src/mongo/db/s/sharding_initialization_mongod.cpp @@ -49,7 +49,6 @@ #include "mongo/db/s/chunk_splitter.h" #include "mongo/db/s/periodic_balancer_config_refresher.h" #include "mongo/db/s/read_only_catalog_cache_loader.h" -#include "mongo/db/s/shard_filtering_metadata_refresh.h" #include "mongo/db/s/shard_server_catalog_cache_loader.h" #include "mongo/db/s/sharding_config_optime_gossip.h" #include "mongo/db/s/transaction_coordinator_service.h" @@ -65,7 +64,6 @@ #include "mongo/s/config_server_catalog_cache_loader.h" #include "mongo/s/grid.h" #include "mongo/s/sharding_initialization.h" -#include "mongo/util/exit.h" #include "mongo/util/log.h" namespace mongo { @@ -167,7 +165,7 @@ void ShardingInitializationMongoD::initializeShardingEnvironmentOnShardServer( bool isStandaloneOrPrimary = !isReplSet || (replCoord->getMemberState() == repl::MemberState::RS_PRIMARY); - getCatalogCacheLoaderForFiltering(opCtx).initializeReplicaSetRole(isStandaloneOrPrimary); + CatalogCacheLoader::get(opCtx).initializeReplicaSetRole(isStandaloneOrPrimary); ChunkSplitter::get(opCtx).onShardingInitialization(isStandaloneOrPrimary); PeriodicBalancerConfigRefresher::get(opCtx).onShardingInitialization(opCtx->getServiceContext(), isStandaloneOrPrimary); @@ -412,46 +410,17 @@ void initializeGlobalShardingStateForMongoD(OperationContext* opCtx, auto const service = opCtx->getServiceContext(); - - if (serverGlobalParams.clusterRole == ClusterRole::ShardServer && - hasAdditionalCatalogCacheForFiltering()) { - // Setup additional CatalogCache for filtering only - setCatalogCacheLoaderForFiltering(service, - std::make_unique<ShardServerCatalogCacheLoader>( - std::make_unique<ConfigServerCatalogCacheLoader>())); - setCatalogCacheForFiltering( - service, std::make_unique<CatalogCache>(getCatalogCacheLoaderForFiltering(opCtx))); - registerShutdownTask( - [service]() { getCatalogCacheLoaderForFiltering(service).shutDown(); }); - } - - // Make primary CatalogCacheLoader according to the cluster Role - auto makeCatalogCacheLoader = []() -> std::unique_ptr<CatalogCacheLoader> { - switch (serverGlobalParams.clusterRole) { - case ClusterRole::ShardServer: - if (storageGlobalParams.readOnly) { - return std::make_unique<ReadOnlyCatalogCacheLoader>(); - } - if (hasAdditionalCatalogCacheForFiltering()) { - // The primary CatalogCache will be used only for routing - return std::make_unique<ConfigServerCatalogCacheLoader>(); - } - - // Normal ShardServer without additional cache for filtering - return std::make_unique<ShardServerCatalogCacheLoader>( - std::make_unique<ConfigServerCatalogCacheLoader>()); - break; - - case ClusterRole::ConfigServer: - return std::make_unique<ConfigServerCatalogCacheLoader>(); - break; - - default: - MONGO_UNREACHABLE; + if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { + if (storageGlobalParams.readOnly) { + CatalogCacheLoader::set(service, std::make_unique<ReadOnlyCatalogCacheLoader>()); + } else { + CatalogCacheLoader::set(service, + std::make_unique<ShardServerCatalogCacheLoader>( + std::make_unique<ConfigServerCatalogCacheLoader>())); } - }; - - CatalogCacheLoader::set(service, makeCatalogCacheLoader()); + } else { + CatalogCacheLoader::set(service, std::make_unique<ConfigServerCatalogCacheLoader>()); + } auto validator = LogicalTimeValidator::get(service); if (validator) { // The keyManager may be existing if the node was a part of a standalone RS. |