summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2017-02-03 18:24:31 -0500
committerRandolph Tan <randolph@10gen.com>2017-02-17 17:29:00 -0500
commit52984455b85605acee3855aa6fbb67b0cde25470 (patch)
treeaa242a25952bd80371bb1ba3d6ee478e97e0761d /src/mongo/s
parente15ad9012a61c7de7fffb942e2e999331e73d6a6 (diff)
downloadmongo-52984455b85605acee3855aa6fbb67b0cde25470.tar.gz
SERVER-27855 Attach all NetworkInterface instances with EgressHooks
with the exception of: - NetworkInterfaceCollectionRangeDeleter-TaskExecutor (doesn't really use network) - AddShard-TaskExecutor (destination shard is still not part of cluster)
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/client/shard_registry.cpp7
-rw-r--r--src/mongo/s/server.cpp8
-rw-r--r--src/mongo/s/sharding_initialization.cpp1
-rw-r--r--src/mongo/s/sharding_initialization.h5
4 files changed, 15 insertions, 6 deletions
diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp
index 2b46213ec6b..5f30b22c8ea 100644
--- a/src/mongo/s/client/shard_registry.cpp
+++ b/src/mongo/s/client/shard_registry.cpp
@@ -41,11 +41,13 @@
#include "mongo/db/client.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/server_options.h"
+#include "mongo/executor/network_connection_hook.h"
#include "mongo/executor/network_interface_factory.h"
#include "mongo/executor/network_interface_thread_pool.h"
#include "mongo/executor/task_executor.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/executor/thread_pool_task_executor.h"
+#include "mongo/rpc/metadata/egress_metadata_hook_list.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard.h"
@@ -190,8 +192,11 @@ void ShardRegistry::startup() {
// startup() must be called only once
invariant(!_executor);
+ auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>();
+ // TODO SERVER-27750: add LogicalTimeMetadataHook
+
// construct task executor
- auto net = executor::makeNetworkInterface("ShardRegistryUpdater");
+ auto net = executor::makeNetworkInterface("ShardRegistryUpdater", nullptr, std::move(hookList));
auto netPtr = net.get();
_executor = stdx::make_unique<ThreadPoolTaskExecutor>(
stdx::make_unique<NetworkInterfaceThreadPool>(netPtr), std::move(net));
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index 1a5d0b28ea9..3fd4d4fb3dc 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -63,6 +63,7 @@
#include "mongo/db/wire_version.h"
#include "mongo/executor/task_executor_pool.h"
#include "mongo/platform/process_id.h"
+#include "mongo/rpc/metadata/egress_metadata_hook_list.h"
#include "mongo/s/balancer_configuration.h"
#include "mongo/s/catalog/sharding_catalog_client.h"
#include "mongo/s/catalog/sharding_catalog_manager.h"
@@ -201,7 +202,12 @@ static Status initializeSharding(OperationContext* txn) {
mongosGlobalParams.configdbs,
generateDistLockProcessId(txn),
std::move(shardFactory),
- []() { return stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(); },
+ []() {
+ auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>();
+ // TODO SERVER-27750: add LogicalTimeMetadataHook
+ hookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>());
+ return hookList;
+ },
[](ShardingCatalogClient* catalogClient, std::unique_ptr<executor::TaskExecutor> executor) {
return nullptr; // Only config servers get a real ShardingCatalogManager.
});
diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp
index a98d9b0941f..a4e3108eba4 100644
--- a/src/mongo/s/sharding_initialization.cpp
+++ b/src/mongo/s/sharding_initialization.cpp
@@ -60,7 +60,6 @@
#include "mongo/s/cluster_identity_loader.h"
#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
-#include "mongo/s/sharding_egress_metadata_hook.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/exit.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/sharding_initialization.h b/src/mongo/s/sharding_initialization.h
index 94973f0f24f..33e3046074c 100644
--- a/src/mongo/s/sharding_initialization.h
+++ b/src/mongo/s/sharding_initialization.h
@@ -51,9 +51,8 @@ using ShardingCatalogManagerBuilder = stdx::function<std::unique_ptr<ShardingCat
ShardingCatalogClient*, std::unique_ptr<executor::TaskExecutor>)>;
namespace rpc {
-class ShardingEgressMetadataHook;
-using ShardingEgressMetadataHookBuilder =
- stdx::function<std::unique_ptr<ShardingEgressMetadataHook>()>;
+class EgressMetadataHook;
+using ShardingEgressMetadataHookBuilder = stdx::function<std::unique_ptr<EgressMetadataHook>()>;
} // namespace rpc
/**