summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Liu <rui.liu@mongodb.com>2022-07-28 13:00:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-07-28 13:40:03 +0000
commit8c67e03cebd15d7816db29a464a2ba0f6ef843fc (patch)
tree83f40e0cb36b7c379666e1b094dda9675c662956
parent96a8cae8108842586852dd8b1ea6b9583feb0763 (diff)
SERVER-67377 Check whether $lookup pushdown feature availability on primary shard in mixed version cluster
-rw-r--r--jstests/core/index_stats.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/jstests/core/index_stats.js b/jstests/core/index_stats.js
index 43df9a63ed1..ce5c9901e48 100644
--- a/jstests/core/index_stats.js
+++ b/jstests/core/index_stats.js
@@ -18,12 +18,18 @@
"use strict";
load("jstests/libs/analyze_plan.js");
-load("jstests/libs/sbe_util.js"); // For checkSBEEnabled.
+load("jstests/libs/sbe_util.js"); // For checkSBEEnabled.
+load('jstests/libs/fixture_helpers.js'); // For 'FixtureHelpers'
var colName = "jstests_index_stats";
var col = db[colName];
col.drop();
+function checkSBEEnabledOnHostingDB(db, featureFlags = []) {
+ return checkSBEEnabled(FixtureHelpers.getPrimaryForNodeHostingDatabase(db).getDB(db.getName()),
+ featureFlags);
+}
+
var getUsageCount = function(indexName, collection) {
collection = collection || col;
var cursor = collection.aggregate([{$indexStats: {}}]);
@@ -234,7 +240,7 @@ assert.eq(2,
])
.itcount());
assert.eq(1, getUsageCount("_id_", col), "Expected aggregation to use _id index");
-if (!checkSBEEnabled(db, ["featureFlagSBELookupPushdown"])) {
+if (!checkSBEEnabledOnHostingDB(db, ["featureFlagSBELookupPushdown"])) {
assert.eq(2,
getUsageCount("_id_", foreignCollection),
"Expected each lookup to be tracked as an index use");
@@ -272,7 +278,7 @@ const pipeline = [
];
assert.eq(2, col.aggregate(pipeline).itcount());
assert.eq(1, getUsageCount("_id_", col), "Expected aggregation to use _id index");
-if (!checkSBEEnabled(db, ["featureFlagSBELookupPushdown"])) {
+if (!checkSBEEnabledOnHostingDB(db, ["featureFlagSBELookupPushdown"])) {
assert.eq(2,
getUsageCount("_id_", foreignCollection),
"Expected each lookup to be tracked as an index use");