diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-08-01 12:23:50 -0400 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-08-09 08:50:44 -0400 |
commit | aa102021070c10f802b9be8877870400cc27ed07 (patch) | |
tree | 8ea72176a012413adfdd337c38a563c1524d0334 /src/mongo/db/s/sharding_initialization_mongod.cpp | |
parent | 9f2e54384d90ab0c533c6d311337d6bcc8fb5679 (diff) | |
download | mongo-aa102021070c10f802b9be8877870400cc27ed07.tar.gz |
SERVER-29694 Read-only shards should not try to persist the collection routing information locally
Diffstat (limited to 'src/mongo/db/s/sharding_initialization_mongod.cpp')
-rw-r--r-- | src/mongo/db/s/sharding_initialization_mongod.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp index d109854769b..50bff361b30 100644 --- a/src/mongo/db/s/sharding_initialization_mongod.cpp +++ b/src/mongo/db/s/sharding_initialization_mongod.cpp @@ -38,6 +38,7 @@ #include "mongo/client/remote_command_targeter_factory_impl.h" #include "mongo/db/logical_time_metadata_hook.h" #include "mongo/db/operation_context.h" +#include "mongo/db/s/read_only_catalog_cache_loader.h" #include "mongo/db/s/shard_server_catalog_cache_loader.h" #include "mongo/db/s/sharding_egress_metadata_hook_for_mongod.h" #include "mongo/db/server_options.h" @@ -88,9 +89,14 @@ Status initializeGlobalShardingStateForMongod(OperationContext* opCtx, stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { - CatalogCacheLoader::set(opCtx->getServiceContext(), - stdx::make_unique<ShardServerCatalogCacheLoader>( - stdx::make_unique<ConfigServerCatalogCacheLoader>())); + if (storageGlobalParams.readOnly) { + CatalogCacheLoader::set(opCtx->getServiceContext(), + stdx::make_unique<ReadOnlyCatalogCacheLoader>()); + } else { + CatalogCacheLoader::set(opCtx->getServiceContext(), + stdx::make_unique<ShardServerCatalogCacheLoader>( + stdx::make_unique<ConfigServerCatalogCacheLoader>())); + } } else { CatalogCacheLoader::set(opCtx->getServiceContext(), stdx::make_unique<ConfigServerCatalogCacheLoader>()); |