summaryrefslogtreecommitdiff
path: root/src/mongo/s/server.cpp
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2018-01-22 11:32:23 -0500
committerJack Mulrow <jack.mulrow@mongodb.com>2018-03-08 17:49:26 -0500
commit66b82f4eb006b71d0c8a63ca982be8e943280941 (patch)
tree3a8b852fd8f9ab11869e2c7b88648125b81d5d7f /src/mongo/s/server.cpp
parent5bf81cc55555124280d88a54396df2a64bcef8ce (diff)
downloadmongo-66b82f4eb006b71d0c8a63ca982be8e943280941.tar.gz
SERVER-33017 Add metadata hook to update lastCommittedOpTime on mongos per shard
Diffstat (limited to 'src/mongo/s/server.cpp')
-rw-r--r--src/mongo/s/server.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index c03b7a920df..449f51389db 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -75,6 +75,7 @@
#include "mongo/s/client/shard_remote.h"
#include "mongo/s/client/sharding_connection_hook.h"
#include "mongo/s/commands/kill_sessions_remote.h"
+#include "mongo/s/committed_optime_metadata_hook.h"
#include "mongo/s/config_server_catalog_cache_loader.h"
#include "mongo/s/grid.h"
#include "mongo/s/is_mongos.h"
@@ -297,6 +298,8 @@ 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::CommittedOpTimeMetadataHook>(opCtx->getServiceContext()));
hookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(
opCtx->getServiceContext()));
return hookList;
@@ -353,6 +356,10 @@ ExitCode runMongosServer(ServiceContext* serviceContext) {
unshardedHookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext));
unshardedHookList->addHook(
stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext));
+ // TODO SERVER-33053: readReplyMetadata is not called on hooks added through
+ // ShardingConnectionHook with _shardedConnections=false, so this hook will not run for
+ // connections using globalConnPool.
+ unshardedHookList->addHook(stdx::make_unique<rpc::CommittedOpTimeMetadataHook>(serviceContext));
// Add sharding hooks to both connection pools - ShardingConnectionHook includes auth hooks
globalConnPool.addHook(new ShardingConnectionHook(false, std::move(unshardedHookList)));
@@ -361,6 +368,7 @@ ExitCode runMongosServer(ServiceContext* serviceContext) {
shardedHookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext));
shardedHookList->addHook(
stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext));
+ shardedHookList->addHook(stdx::make_unique<rpc::CommittedOpTimeMetadataHook>(serviceContext));
shardConnectionPool.addHook(new ShardingConnectionHook(true, std::move(shardedHookList)));