diff options
author | Rachita Dhawan <rachita.dhawan@gmail.com> | 2023-01-18 22:08:56 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-23 22:41:56 +0000 |
commit | cc379041cd9c42ab9d2b1eed97011e3f7d6189ef (patch) | |
tree | 632f7c6ff36bcebb926b8f5e70cf81b07eff876f | |
parent | db9f4329fe249dcd2a31f7edebcd1bc5a68d98b5 (diff) | |
download | mongo-cc379041cd9c42ab9d2b1eed97011e3f7d6189ef.tar.gz |
SERVER-70640 Add migrationConcurrency to serverStatus
(cherry picked from commit 28a53314e42d11a11bf4dea0a40d3be164d30e8b)
-rw-r--r-- | jstests/sharding/move_chunk_concurrent_cloning.js | 6 | ||||
-rw-r--r-- | src/mongo/db/s/migration_destination_manager.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_statistics.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_statistics.h | 3 |
4 files changed, 15 insertions, 0 deletions
diff --git a/jstests/sharding/move_chunk_concurrent_cloning.js b/jstests/sharding/move_chunk_concurrent_cloning.js index dfd04e3eb5e..8ce55176b3c 100644 --- a/jstests/sharding/move_chunk_concurrent_cloning.js +++ b/jstests/sharding/move_chunk_concurrent_cloning.js @@ -93,6 +93,12 @@ const runParallelMoveChunk = (numThreads) => { shardKeyIdx--; assert.eq(shardKeyIdx, kInitialLoadFinalKey + 1000); + // server Status on the receiving shard + var serverStatus = st.shard1.getDB('admin').runCommand({serverStatus: 1}); + + assert.eq(kThreadCount, + serverStatus.shardingStatistics.chunkMigrationConcurrency, + tojson(serverStatus)); st.stop(); MongoRunner.stopMongod(staticMongod); }; diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index 4cbcf6cb260..2f5230b1702 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -489,6 +489,9 @@ Status MigrationDestinationManager::start(OperationContext* opCtx, _sessionMigration = std::make_unique<SessionCatalogMigrationDestination>( _nss, _fromShard, *_sessionId, _cancellationSource.token()); ShardingStatistics::get(opCtx).countRecipientMoveChunkStarted.addAndFetch(1); + if (mongo::feature_flags::gConcurrencyInChunkMigration.isEnabledAndIgnoreFCV()) + ShardingStatistics::get(opCtx).chunkMigrationConcurrencyCnt.store( + chunkMigrationConcurrency.load()); _migrateThreadHandle = stdx::thread([this, cancellationToken = _cancellationSource.token()]() { _migrateThread(cancellationToken); diff --git a/src/mongo/db/s/sharding_statistics.cpp b/src/mongo/db/s/sharding_statistics.cpp index a32642776dd..ea17a500202 100644 --- a/src/mongo/db/s/sharding_statistics.cpp +++ b/src/mongo/db/s/sharding_statistics.cpp @@ -34,6 +34,7 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" +#include "mongo/s/sharding_feature_flags_gen.h" namespace mongo { namespace { @@ -69,6 +70,8 @@ void ShardingStatistics::report(BSONObjBuilder* builder) const { countDonorMoveChunkAbortConflictingIndexOperation.load()); builder->append("unfinishedMigrationFromPreviousPrimary", unfinishedMigrationFromPreviousPrimary.load()); + if (mongo::feature_flags::gConcurrencyInChunkMigration.isEnabledAndIgnoreFCV()) + builder->append("chunkMigrationConcurrency", chunkMigrationConcurrencyCnt.load()); } } // namespace mongo diff --git a/src/mongo/db/s/sharding_statistics.h b/src/mongo/db/s/sharding_statistics.h index b4332452a8d..91a10cc4308 100644 --- a/src/mongo/db/s/sharding_statistics.h +++ b/src/mongo/db/s/sharding_statistics.h @@ -104,6 +104,9 @@ struct ShardingStatistics { // completion. Valid only when this process is the repl set primary. AtomicWord<long long> unfinishedMigrationFromPreviousPrimary{0}; + // Current number for chunkMigrationConcurrency that defines concurrent fetchers and inserters + // used for _migrateClone(step 4) of chunk migration + AtomicWord<int> chunkMigrationConcurrencyCnt{1}; /** * Obtains the per-process instance of the sharding statistics object. */ |