diff options
author | Randolph Tan <randolph@10gen.com> | 2017-03-08 11:31:04 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2017-03-08 17:59:35 -0500 |
commit | 34dbe2a42d1db621f16555878b57f48efb30cc28 (patch) | |
tree | e8533f9703177022e21073a1b5a3fceb76b5b178 /src/mongo/s/server.cpp | |
parent | 91cf24955de997983ab675e35c98ccfa1e608d62 (diff) | |
download | mongo-34dbe2a42d1db621f16555878b57f48efb30cc28.tar.gz |
SERVER-27750 Attach LogicalTimeMetadata to globalConnPool and shardConnectionPool
This also include refactor work to cleanup ShardingEgressMetadataHook api and allow ShardingConnectionHook to take EgressMetadataHookList.
Diffstat (limited to 'src/mongo/s/server.cpp')
-rw-r--r-- | src/mongo/s/server.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index bd177748fcf..d3a797b3a49 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -207,7 +207,7 @@ static Status initializeSharding(OperationContext* opCtx) { auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>(); hookList->addHook( stdx::make_unique<rpc::LogicalTimeMetadataHook>(opCtx->getServiceContext())); - hookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>()); + hookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(false)); return hookList; }, [](ShardingCatalogClient* catalogClient, std::unique_ptr<executor::TaskExecutor> executor) { @@ -257,12 +257,20 @@ static ExitCode runMongosServer() { return EXIT_NET_ERROR; } + auto unshardedHookList = stdx::make_unique<rpc::EgressMetadataHookList>(); + unshardedHookList->addHook( + stdx::make_unique<rpc::LogicalTimeMetadataHook>(getGlobalServiceContext())); + unshardedHookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(false)); + // Add sharding hooks to both connection pools - ShardingConnectionHook includes auth hooks - globalConnPool.addHook(new ShardingConnectionHook( - false, stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>())); + globalConnPool.addHook(new ShardingConnectionHook(false, std::move(unshardedHookList))); + + auto shardedHookList = stdx::make_unique<rpc::EgressMetadataHookList>(); + shardedHookList->addHook( + stdx::make_unique<rpc::LogicalTimeMetadataHook>(getGlobalServiceContext())); + shardedHookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(true)); - shardConnectionPool.addHook(new ShardingConnectionHook( - true, stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>())); + shardConnectionPool.addHook(new ShardingConnectionHook(true, std::move(shardedHookList))); ReplicaSetMonitor::setAsynchronousConfigChangeHook( &ShardRegistry::replicaSetChangeConfigServerUpdateHook); |