diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2023-04-13 09:49:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-04-13 10:36:28 +0000 |
commit | 613ec33b04f046be90c457d0226e8f154e1b285d (patch) | |
tree | c4ec00a6338cd4f8be2f7a8e6471162c30d75130 | |
parent | 9bdc6bbc395f0f547cf3f8987379a115466d8584 (diff) | |
download | mongo-613ec33b04f046be90c457d0226e8f154e1b285d.tar.gz |
SERVER-75639 Remove dedicated executor for moveChunk/moveRange commands
-rw-r--r-- | src/mongo/db/s/shardsvr_move_range_command.cpp | 24 |
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 99460cde653..0c4845afe06 100644 --- a/src/mongo/db/s/shardsvr_move_range_command.cpp +++ b/src/mongo/db/s/shardsvr_move_range_command.cpp @@ -99,7 +99,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), @@ -225,28 +225,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; |