summaryrefslogtreecommitdiff
path: root/jstests/core
diff options
context:
space:
mode:
authorColin Stolley <ccstolley@github.com>2022-10-28 14:47:52 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-28 15:17:36 +0000
commit0dc38aed4c9017b1b776b65eb6748304fec0eddc (patch)
tree4c16c6fb230b300c2fa282faeeef7de143e91f8b /jstests/core
parent387b9306518fe31b3ce157c8d57946696d29d9ce (diff)
downloadmongo-0dc38aed4c9017b1b776b65eb6748304fec0eddc.tar.gz
SERVER-70866: Accept indexStat counts greater or equal to 1
Diffstat (limited to 'jstests/core')
-rw-r--r--jstests/core/columnstore_index.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/jstests/core/columnstore_index.js b/jstests/core/columnstore_index.js
index d0841abdaf6..94d0dd355a9 100644
--- a/jstests/core/columnstore_index.js
+++ b/jstests/core/columnstore_index.js
@@ -53,8 +53,9 @@ let getCSIUsageCount = function(collection) {
collection
.aggregate([{$indexStats: {}}, {$match: {$expr: {$eq: ["$key", {$literal: csIdx}]}}}])
.toArray();
- assert.eq(csi.length, 1);
- return csi[0].accesses.ops;
+ return csi.reduce((accum, s) => {
+ return accum + s.accesses.ops;
+ }, 0);
};
// Test index stats have sensible usage count values for column store indexes.
@@ -63,7 +64,9 @@ assert.eq(getCSIUsageCount(coll), usageCount);
const res = coll.aggregate([{"$project": {"a": 1, _id: 0}}, {"$match": {a: 1}}]);
assert.eq(res.itcount(), 1);
usageCount++;
-assert.eq(getCSIUsageCount(coll), usageCount);
+// on sharded collections, each matching shard will reply "1", meaning
+// we could get a correct usage total greater than 1.
+assert.gte(getCSIUsageCount(coll), usageCount);
// Test collStats have sensible values for column store indexes
const cs = coll.aggregate([{$collStats: {storageStats: {}}}]).next();