diff options
Diffstat (limited to 'jstests/core/explain_sample.js')
-rw-r--r-- | jstests/core/explain_sample.js | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/jstests/core/explain_sample.js b/jstests/core/explain_sample.js index 8bc7b53906f..bb8ea6d54ef 100644 --- a/jstests/core/explain_sample.js +++ b/jstests/core/explain_sample.js @@ -4,39 +4,39 @@ * @tags: [requires_wiredtiger] */ (function() { - "use strict"; +"use strict"; - load("jstests/libs/analyze_plan.js"); +load("jstests/libs/analyze_plan.js"); - // Although this test is tagged with 'requires_wiredtiger', this is not sufficient for ensuring - // that the parallel suite runs this test only on WT configurations. - if (jsTest.options().storageEngine && jsTest.options().storageEngine !== "wiredTiger") { - jsTest.log("Skipping test on non-WT storage engine: " + jsTest.options().storageEngine); - return; - } +// Although this test is tagged with 'requires_wiredtiger', this is not sufficient for ensuring +// that the parallel suite runs this test only on WT configurations. +if (jsTest.options().storageEngine && jsTest.options().storageEngine !== "wiredTiger") { + jsTest.log("Skipping test on non-WT storage engine: " + jsTest.options().storageEngine); + return; +} - const coll = db.explain_sample; - coll.drop(); +const coll = db.explain_sample; +coll.drop(); - let docsToInsert = []; - for (let i = 0; i < 1000; ++i) { - docsToInsert.push({_id: i}); - } - assert.commandWorked(coll.insert(docsToInsert)); +let docsToInsert = []; +for (let i = 0; i < 1000; ++i) { + docsToInsert.push({_id: i}); +} +assert.commandWorked(coll.insert(docsToInsert)); - // Verify that explain reports execution stats for the MULTI_ITERATOR stage. This is designed to - // reproduce SERVER-35973. - const explain = - assert.commandWorked(coll.explain("allPlansExecution").aggregate([{$sample: {size: 10}}])); - const multiIteratorStages = getAggPlanStages(explain, "MULTI_ITERATOR"); - assert.gt(multiIteratorStages.length, 0, tojson(explain)); - assert.gt(multiIteratorStages.reduce((acc, stage) => acc + stage.nReturned, 0), - 0, - tojson(multiIteratorStages)); - assert.gt(multiIteratorStages.reduce((acc, stage) => acc + stage.advanced, 0), - 0, - tojson(multiIteratorStages)); - assert.gt(multiIteratorStages.reduce((acc, stage) => acc + stage.works, 0), - 0, - tojson(multiIteratorStages)); +// Verify that explain reports execution stats for the MULTI_ITERATOR stage. This is designed to +// reproduce SERVER-35973. +const explain = + assert.commandWorked(coll.explain("allPlansExecution").aggregate([{$sample: {size: 10}}])); +const multiIteratorStages = getAggPlanStages(explain, "MULTI_ITERATOR"); +assert.gt(multiIteratorStages.length, 0, tojson(explain)); +assert.gt(multiIteratorStages.reduce((acc, stage) => acc + stage.nReturned, 0), + 0, + tojson(multiIteratorStages)); +assert.gt(multiIteratorStages.reduce((acc, stage) => acc + stage.advanced, 0), + 0, + tojson(multiIteratorStages)); +assert.gt(multiIteratorStages.reduce((acc, stage) => acc + stage.works, 0), + 0, + tojson(multiIteratorStages)); }()); |