summaryrefslogtreecommitdiff
path: root/src/mongo/s/sharding_initialization.cpp
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2019-04-15 14:01:30 -0400
committerBen Caimano <ben.caimano@10gen.com>2019-06-10 16:29:00 -0400
commit666e5276aa6b22e59bf91a5d0e5883648b9a0865 (patch)
treec52dce9f656e0a6fc72c60804cb615897b0186e9 /src/mongo/s/sharding_initialization.cpp
parent45138bb6ba07bd74793814e78c2bf9b277ffff4f (diff)
downloadmongo-666e5276aa6b22e59bf91a5d0e5883648b9a0865.tar.gz
SERVER-39819 SERVER-39820 Add HostGroup Controller impl to tie together replSets
Diffstat (limited to 'src/mongo/s/sharding_initialization.cpp')
-rw-r--r--src/mongo/s/sharding_initialization.cpp48
1 files changed, 4 insertions, 44 deletions
diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp
index 83fd96367c8..ed9364ea133 100644
--- a/src/mongo/s/sharding_initialization.cpp
+++ b/src/mongo/s/sharding_initialization.cpp
@@ -65,6 +65,7 @@
#include "mongo/s/grid.h"
#include "mongo/s/query/cluster_cursor_manager.h"
#include "mongo/s/sharding_task_executor.h"
+#include "mongo/s/sharding_task_executor_pool_controller.h"
#include "mongo/s/sharding_task_executor_pool_gen.h"
#include "mongo/util/concurrency/thread_pool.h"
#include "mongo/util/exit.h"
@@ -171,52 +172,11 @@ Status initializeGlobalShardingState(OperationContext* opCtx,
return {ErrorCodes::BadValue, "Unrecognized connection string."};
}
- // We don't set the ConnectionPool's static const variables to be the default value in
- // MONGO_EXPORT_STARTUP_SERVER_PARAMETER because it's not guaranteed to be initialized.
- // The following code is a workaround.
ConnectionPool::Options connPoolOptions;
+ connPoolOptions.controller = std::make_shared<ShardingTaskExecutorPoolController>();
- connPoolOptions.minConnections = gShardingTaskExecutorPoolMinConnections;
- connPoolOptions.maxConnections = (gShardingTaskExecutorPoolMaxConnections >= 0)
- ? gShardingTaskExecutorPoolMaxConnections
- : ConnectionPool::kDefaultMaxConns;
- connPoolOptions.maxConnecting = (gShardingTaskExecutorPoolMaxConnecting >= 0)
- ? gShardingTaskExecutorPoolMaxConnecting
- : ConnectionPool::kDefaultMaxConnecting;
-
- connPoolOptions.hostTimeout = Milliseconds(gShardingTaskExecutorPoolHostTimeoutMS);
- connPoolOptions.refreshRequirement =
- Milliseconds(gShardingTaskExecutorPoolRefreshRequirementMS);
- connPoolOptions.refreshTimeout = Milliseconds(gShardingTaskExecutorPoolRefreshTimeoutMS);
-
- if (connPoolOptions.refreshRequirement <= connPoolOptions.refreshTimeout) {
- auto newRefreshTimeout = connPoolOptions.refreshRequirement - Milliseconds(1);
- warning() << "ShardingTaskExecutorPoolRefreshRequirementMS ("
- << connPoolOptions.refreshRequirement
- << ") set below ShardingTaskExecutorPoolRefreshTimeoutMS ("
- << connPoolOptions.refreshTimeout
- << "). Adjusting ShardingTaskExecutorPoolRefreshTimeoutMS to "
- << newRefreshTimeout;
- connPoolOptions.refreshTimeout = newRefreshTimeout;
- }
-
- if (connPoolOptions.hostTimeout <=
- connPoolOptions.refreshRequirement + connPoolOptions.refreshTimeout) {
- auto newHostTimeout =
- connPoolOptions.refreshRequirement + connPoolOptions.refreshTimeout + Milliseconds(1);
- warning() << "ShardingTaskExecutorPoolHostTimeoutMS (" << connPoolOptions.hostTimeout
- << ") set below ShardingTaskExecutorPoolRefreshRequirementMS ("
- << connPoolOptions.refreshRequirement
- << ") + ShardingTaskExecutorPoolRefreshTimeoutMS ("
- << connPoolOptions.refreshTimeout
- << "). Adjusting ShardingTaskExecutorPoolHostTimeoutMS to " << newHostTimeout;
- connPoolOptions.hostTimeout = newHostTimeout;
- }
-
- auto network = executor::makeNetworkInterface("ShardRegistry",
- std::make_unique<ShardingNetworkConnectionHook>(),
- hookBuilder(),
- connPoolOptions);
+ auto network = executor::makeNetworkInterface(
+ "ShardRegistry", std::make_unique<ShardingNetworkConnectionHook>(), hookBuilder());
auto networkPtr = network.get();
auto executorPool = makeShardingTaskExecutorPool(
std::move(network), hookBuilder, connPoolOptions, taskExecutorPoolSize);