summaryrefslogtreecommitdiff
path: root/src/mongo/db/s
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp6
-rw-r--r--src/mongo/db/s/sharding_state.cpp2
-rw-r--r--src/mongo/db/s/sharding_state_test.cpp11
3 files changed, 11 insertions, 8 deletions
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
index a9b324eaaad..4fdef19c6b6 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
@@ -464,17 +464,19 @@ StatusWith<BSONObj> MigrationChunkClonerSourceLegacy::_callRecipient(const BSONO
StatusWith<executor::RemoteCommandResponse> responseStatus(
Status{ErrorCodes::InternalError, "Uninitialized value"});
- auto scheduleStatus = grid.shardRegistry()->getExecutor()->scheduleRemoteCommand(
+ auto executor = grid.getExecutorPool()->getArbitraryExecutor();
+ auto scheduleStatus = executor->scheduleRemoteCommand(
executor::RemoteCommandRequest(_recipientHost, "admin", cmdObj),
[&responseStatus](const executor::TaskExecutor::RemoteCommandCallbackArgs& args) {
responseStatus = args.response;
});
+ // TODO: Update RemoteCommandTargeter on NotMaster errors.
if (!scheduleStatus.isOK()) {
return scheduleStatus.getStatus();
}
- grid.shardRegistry()->getExecutor()->wait(scheduleStatus.getValue());
+ executor->wait(scheduleStatus.getValue());
if (!responseStatus.isOK()) {
return responseStatus.getStatus();
diff --git a/src/mongo/db/s/sharding_state.cpp b/src/mongo/db/s/sharding_state.cpp
index 8e12acc8872..bd79cf69884 100644
--- a/src/mongo/db/s/sharding_state.cpp
+++ b/src/mongo/db/s/sharding_state.cpp
@@ -174,7 +174,7 @@ void ShardingState::shutDown(OperationContext* txn) {
}
if (_getInitializationState() == InitializationState::kInitialized) {
- grid.shardRegistry()->shutdown();
+ grid.getExecutorPool()->shutdownAndJoin();
grid.catalogManager(txn)->shutDown(txn);
}
}
diff --git a/src/mongo/db/s/sharding_state_test.cpp b/src/mongo/db/s/sharding_state_test.cpp
index fbaa6a9d678..de9e8b00466 100644
--- a/src/mongo/db/s/sharding_state_test.cpp
+++ b/src/mongo/db/s/sharding_state_test.cpp
@@ -72,16 +72,17 @@ void initGrid(OperationContext* txn, const ConnectionString& configConnString) {
auto executorPool = stdx::make_unique<executor::TaskExecutorPool>();
executorPool->addExecutors(std::move(executorsForPool), std::move(fixedExec));
+ executorPool->startup();
- auto shardRegistry(stdx::make_unique<ShardRegistry>(
- std::move(shardFactory), std::move(executorPool), mockNetwork, configConnString));
- shardRegistry->startup();
+ auto shardRegistry(stdx::make_unique<ShardRegistry>(std::move(shardFactory), configConnString));
grid.init(
stdx::make_unique<CatalogManagerMock>(),
stdx::make_unique<CatalogCache>(),
std::move(shardRegistry),
- stdx::make_unique<ClusterCursorManager>(txn->getServiceContext()->getPreciseClockSource()));
+ stdx::make_unique<ClusterCursorManager>(txn->getServiceContext()->getPreciseClockSource()),
+ std::move(executorPool),
+ mockNetwork);
}
class ShardingStateTest : public mongo::unittest::Test {
@@ -106,7 +107,7 @@ public:
// Cleanup only if shard registry was initialized
if (grid.shardRegistry()) {
- grid.shardRegistry()->shutdown();
+ grid.getExecutorPool()->shutdownAndJoin();
grid.clearForUnitTests();
}
}