diff options
author | Marcos José Grillo Ramirez <marcos.grillo@mongodb.com> | 2023-04-20 17:30:55 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-04-20 21:55:12 +0000 |
commit | 6320d8fc17d90d563bdd8c879c080a81b083fd55 (patch) | |
tree | 7fce8ed2465e568143fd7ae99211bab46d8c2d4c | |
parent | 8a7a9f9fc2b058fc1b433f4c70843a5c9e985ff4 (diff) | |
download | mongo-6320d8fc17d90d563bdd8c879c080a81b083fd55.tar.gz |
SERVER-72146 Add statistic to count the number of bytes cloned from the donor of a migration
(cherry picked from commit a61cb340c33e123b273071488658811be5361d60)
-rw-r--r-- | src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_statistics.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_statistics.h | 4 |
3 files changed, 7 insertions, 0 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 2272599806e..4d98453d5fc 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp @@ -712,6 +712,7 @@ void MigrationChunkClonerSourceLegacy::_nextCloneBatchFromIndexScan(OperationCon lk.unlock(); ShardingStatistics::get(opCtx).countDocsClonedOnDonor.addAndFetch(1); + ShardingStatistics::get(opCtx).countBytesClonedOnDonor.addAndFetch(obj.objsize()); } } catch (DBException& exception) { exception.addContext("Executor error while scanning for documents belonging to chunk"); @@ -782,6 +783,7 @@ void MigrationChunkClonerSourceLegacy::_nextCloneBatchFromCloneLocs(OperationCon } arrBuilder->append(doc->value()); ShardingStatistics::get(opCtx).countDocsClonedOnDonor.addAndFetch(1); + ShardingStatistics::get(opCtx).countBytesClonedOnDonor.addAndFetch(doc->value().objsize()); } } diff --git a/src/mongo/db/s/sharding_statistics.cpp b/src/mongo/db/s/sharding_statistics.cpp index d103ad001fa..de15166cf66 100644 --- a/src/mongo/db/s/sharding_statistics.cpp +++ b/src/mongo/db/s/sharding_statistics.cpp @@ -71,6 +71,7 @@ void ShardingStatistics::report(BSONObjBuilder* builder) const { builder->append("countBytesClonedOnCatchUpOnRecipient", countBytesClonedOnCatchUpOnRecipient.load()); builder->append("countDocsClonedOnDonor", countDocsClonedOnDonor.load()); + builder->append("countBytesClonedOnDonor", countBytesClonedOnDonor.load()); builder->append("countRecipientMoveChunkStarted", countRecipientMoveChunkStarted.load()); builder->append("countDocsDeletedOnDonor", countDocsDeletedOnDonor.load()); builder->append("countDonorMoveChunkLockTimeout", countDonorMoveChunkLockTimeout.load()); diff --git a/src/mongo/db/s/sharding_statistics.h b/src/mongo/db/s/sharding_statistics.h index 7a7efeb1464..d1b3ed2a816 100644 --- a/src/mongo/db/s/sharding_statistics.h +++ b/src/mongo/db/s/sharding_statistics.h @@ -83,6 +83,10 @@ struct ShardingStatistics { // node. AtomicWord<long long> countDocsClonedOnDonor{0}; + // Cumulative, always-increasing counter of how many bytes have been cloned on the donor + // node. + AtomicWord<long long> countBytesClonedOnDonor{0}; + // Cumulative, always-increasing counter of how many documents have been deleted by the // rangeDeleter. AtomicWord<long long> countDocsDeletedOnDonor{0}; |