diff options
author | Brett Nawrocki <brett.nawrocki@mongodb.com> | 2022-04-25 19:06:28 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-26 22:48:05 +0000 |
commit | 1de5826097917875f48ca1ea4f2e53b40139f9ff (patch) | |
tree | 8351aa75746ea37844d6ef38001edd9db894833f | |
parent | 33b1a5fc0c11cdc5e70ed1a6f2b5c5cf3b8349b3 (diff) | |
download | mongo-1de5826097917875f48ca1ea4f2e53b40139f9ff.tar.gz |
SERVER-65924 resharding_histogram_metrics.js checks totalCount or ops
(cherry picked from commit bebe6e97f90a9345f381434339709f18412fd43e)
-rw-r--r-- | jstests/sharding/resharding_histogram_metrics.js | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/jstests/sharding/resharding_histogram_metrics.js b/jstests/sharding/resharding_histogram_metrics.js index c474db95d96..5ee2231cdc4 100644 --- a/jstests/sharding/resharding_histogram_metrics.js +++ b/jstests/sharding/resharding_histogram_metrics.js @@ -1,10 +1,10 @@ -// Test to verify that latency metrics are collected in both currentOp and cumulativeOp -// during resharding. -// -// @tags: [ -// uses_atclustertime, -// ] -// +/** + * Test to verify that latency metrics are collected in both currentOp and cumulativeOp during + * resharding. + * @tags: [ + * uses_atclustertime, + * ] + */ (function() { 'use strict'; @@ -65,6 +65,14 @@ function getReshardingMetricsReport(mongo, role) { } } +function readHistogramTotal(histogram) { + let total = histogram["totalCount"]; + if (total === undefined) { + total = histogram["ops"]; + } + return total; +} + const mongos = testColl.getMongo(); const topology = DiscoverTopology.findConnectedNodes(mongos); const recipientShardNames = reshardingTest.recipientShardNames; @@ -122,12 +130,12 @@ reshardingTest.withReshardingInBackground( // We expect 1 batch insert per document on each shard, plus 1 empty batch // to discover no documents are left. const expectedBatchInserts = reshardingMetrics[kDocumentsCopied] + 1; - const receivedBatchInserts = collClonerFillBatchForInsertHist["ops"]; + const receivedBatchInserts = readHistogramTotal(collClonerFillBatchForInsertHist); assert(expectedBatchInserts == receivedBatchInserts, `expected ${expectedBatchInserts} batch inserts, received ${receivedBatchInserts}`); - firstReshardBatchApplies += oplogApplierApplyBatchHist["ops"]; + firstReshardBatchApplies += readHistogramTotal(oplogApplierApplyBatchHist); }); assert(firstReshardBatchApplies > 0, @@ -174,8 +182,8 @@ recipientShardNames.forEach(function(shardName) { const collClonerFillBatchForInsertHist = reshardingMetrics[kCollClonerFillBatchForInsertLatencyMillis]; - cumulativeBatchApplies += oplogApplierApplyBatchHist["ops"]; - cumulativeBatchInserts += collClonerFillBatchForInsertHist["ops"]; + cumulativeBatchApplies += readHistogramTotal(oplogApplierApplyBatchHist); + cumulativeBatchInserts += readHistogramTotal(collClonerFillBatchForInsertHist); totalDocumentsCopied += reshardingMetrics[kDocumentsCopied]; }); |