summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierlauro Sciarelli <pierlauro.sciarelli@mongodb.com>2023-04-05 14:21:36 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-12 10:21:56 +0000
commitdbd86279b761c4c9709d663f74b09330d394fda3 (patch)
tree5b6d71b2c1d03e7f336635584789179683a4dfa3
parent9cdf8d188da5c964807c8474c2a3dc421b45a50c (diff)
downloadmongo-dbd86279b761c4c9709d663f74b09330d394fda3.tar.gz
SERVER-75639 Remove dedicated executor for moveChunk/moveRange commands
-rw-r--r--src/mongo/db/s/shardsvr_move_range_command.cpp24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/mongo/db/s/shardsvr_move_range_command.cpp b/src/mongo/db/s/shardsvr_move_range_command.cpp
index df6d900aa3c..221c9567e29 100644
--- a/src/mongo/db/s/shardsvr_move_range_command.cpp
+++ b/src/mongo/db/s/shardsvr_move_range_command.cpp
@@ -97,7 +97,7 @@ public:
// Check if there is an existing migration running and if so, join it
if (scopedMigration.mustExecute()) {
auto moveChunkComplete =
- ExecutorFuture<void>(_getExecutor())
+ ExecutorFuture<void>(Grid::get(opCtx)->getExecutorPool()->getFixedExecutor())
.then([req = request(),
writeConcern = opCtx->getWriteConcern(),
scopedMigration = std::move(scopedMigration),
@@ -224,28 +224,6 @@ public:
migrationSourceManager.commitChunkOnRecipient();
migrationSourceManager.commitChunkMetadataOnConfig();
}
-
- // Returns a single-threaded executor to be used to run moveChunk commands. The executor is
- // initialized on the first call to this function. Uses a shared_ptr because a shared_ptr is
- // required to work with ExecutorFutures.
- static std::shared_ptr<ThreadPool> _getExecutor() {
- static Mutex mutex = MONGO_MAKE_LATCH("MoveChunkExecutor::_mutex");
- static std::shared_ptr<ThreadPool> executor;
-
- stdx::lock_guard<Latch> lg(mutex);
- if (!executor) {
- ThreadPool::Options options;
- options.poolName = "MoveChunk";
- options.minThreads = 0;
- // We limit the size of the thread pool to a single thread because currently there
- // can only be one moveRange operation on a shard at a time.
- options.maxThreads = 1;
- executor = std::make_shared<ThreadPool>(std::move(options));
- executor->startup();
- }
-
- return executor;
- }
};
} _shardsvrMoveRangeCmd;