diff options
author | Ruoxin Xu <ruoxin.xu@mongodb.com> | 2021-11-10 12:17:33 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-10 12:58:55 +0000 |
commit | 4d95f6461e79119ff6f5d9d69a42edcb0de92caa (patch) | |
tree | d341557dccc805426daf4a0ba5a414b99b171ad0 /jstests/core | |
parent | 22fad2bc60c4af6d02c87401b2186efa5bb4b7c8 (diff) | |
download | mongo-4d95f6461e79119ff6f5d9d69a42edcb0de92caa.tar.gz |
SERVER-60339 Add support for $planCacheStats
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/plan_cache_sbe.js | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/jstests/core/plan_cache_sbe.js b/jstests/core/plan_cache_sbe.js index 063e8dafd14..3cd7511ef8c 100644 --- a/jstests/core/plan_cache_sbe.js +++ b/jstests/core/plan_cache_sbe.js @@ -20,11 +20,6 @@ load("jstests/libs/sbe_util.js"); // For checkSBEEnabled. load("jstests/libs/sbe_explain_helpers.js"); // For engineSpecificAssertion. -if (checkSBEEnabled(db, ["featureFlagSbePlanCache"])) { - jsTest.log("Skipping test because SBE and SBE plan cache are both enabled."); - return; -} - const coll = db.plan_cache_sbe; coll.drop(); @@ -42,12 +37,24 @@ const allStats = coll.aggregate([{$planCacheStats: {}}]).toArray(); assert.eq(allStats.length, 1, allStats); const stats = allStats[0]; assert(stats.hasOwnProperty("cachedPlan"), stats); -engineSpecificAssertion(!stats.cachedPlan.hasOwnProperty("queryPlan"), - stats.cachedPlan.hasOwnProperty("queryPlan"), - db, - stats); -engineSpecificAssertion(!stats.cachedPlan.hasOwnProperty("slotBasedPlan"), - stats.cachedPlan.hasOwnProperty("slotBasedPlan"), - db, - stats); + +if (!checkSBEEnabled(db, ["featureFlagSbePlanCache"])) { + // TODO SERVER-61314: Please modify this branch when "featureFlagSbePlanCache" is removed. + // Currently this branch will be taken if either 1) SBE is disabled, or 2) SBE is enabled but + // the "featureFlagSbePlanCache" flag is disabled. + engineSpecificAssertion(!stats.cachedPlan.hasOwnProperty("queryPlan"), + stats.cachedPlan.hasOwnProperty("queryPlan"), + db, + stats); + engineSpecificAssertion(!stats.cachedPlan.hasOwnProperty("slotBasedPlan"), + stats.cachedPlan.hasOwnProperty("slotBasedPlan"), + db, + stats); +} else { + engineSpecificAssertion( + !stats.cachedPlan.hasOwnProperty("slots") && !stats.cachedPlan.hasOwnProperty("stages"), + stats.cachedPlan.hasOwnProperty("slots") && stats.cachedPlan.hasOwnProperty("stages"), + db, + stats); +} })(); |