diff options
author | David Storch <david.storch@mongodb.com> | 2020-09-02 18:05:44 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-03 21:55:22 +0000 |
commit | ac9aa69929bb2f1b9d5014aa3de5799abfded18c (patch) | |
tree | 66b3f9d4f958fdb317e71ac5b799539a764699f0 /jstests/noPassthrough/currentop_query.js | |
parent | cce8380c750dc9d45d88665e0e451013177fcd7a (diff) | |
download | mongo-ac9aa69929bb2f1b9d5014aa3de5799abfded18c.tar.gz |
SERVER-48616 Make SBE expose the correct 'numYields' statistic
Also makes SBE support the 'setYieldAllLocksHang' and
'setYieldAllLocksWait' failpoints. This in turn allows
several yielding-related integration tests to be augmented
to cover SBE.
Diffstat (limited to 'jstests/noPassthrough/currentop_query.js')
-rw-r--r-- | jstests/noPassthrough/currentop_query.js | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/jstests/noPassthrough/currentop_query.js b/jstests/noPassthrough/currentop_query.js index feea034b03b..c0c7cfe0f16 100644 --- a/jstests/noPassthrough/currentop_query.js +++ b/jstests/noPassthrough/currentop_query.js @@ -90,17 +90,31 @@ function runTests({conn, readMode, currentOp, truncatedOps, localOps}) { * Captures currentOp() for a given test command/operation and confirms that namespace, * operation type and planSummary are correct. * - * @param {Object} testObj - Contains test arguments. - * @param {function} testObj.test - A function that runs the desired test op/cmd. - * @param {string} testObj.planSummary - A string containing the expected planSummary. - * @param {Object} testObj.currentOpFilter - A filter to be used to narrow currentOp() - * output to only the relevant operation or command. - * @param {string} [testObj.command] - The command to test against. Will look for this to - * be a key in the currentOp().query object. - * @param {string} [testObj.operation] - The operation to test against. Will look for this - * to be the value of the currentOp().op field. + * - 'testObj' - Contains test arguments. + * - 'testObj.test' - A function that runs the desired test op/cmd. + * - 'testObj.planSummary' - A string containing the expected planSummary. + * - 'testObj.currentOpFilter' - A filter to be used to narrow currentOp() output to only the + * relevant operation or command. + * - 'testObj.command]' - The command to test against. Will look for this to be a key in the + * currentOp().query object. + * - 'testObj.operation' - The operation to test against. Will look for this to be the value + * of the currentOp().op field. + * - 'testObj.useSbe' - True if the server should be configured to use the slot-based execution + * engine rather than the classic query execution engine. */ function confirmCurrentOpContents(testObj) { + const useSbe = testObj.useSbe || false; + // TODO SERVER-50712: SBE is not currently expected to be able to run queries that require + // shard filtering. If the test asks for SBE and we are running against mongos, just skip + // this case. + if (useSbe && FixtureHelpers.isMongos(conn.getDB("admin"))) { + return; + } + FixtureHelpers.runCommandOnEachPrimary({ + db: conn.getDB("admin"), + cmdObj: {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: useSbe} + }); + // Force queries to hang on yield to allow for currentOp capture. FixtureHelpers.runCommandOnEachPrimary({ db: conn.getDB("admin"), @@ -246,6 +260,20 @@ function runTests({conn, readMode, currentOp, truncatedOps, localOps}) { }, { test: function(db) { + assert.eq( + db.currentop_query.find({a: 1}).comment("currentop_query_sbe").itcount(), + 1); + }, + command: "find", + useSbe: true, + // TODO SERVER-50743: The slot-based execution engine does not yet generate real + // 'planSummary' strings. Once it is improved to do so, this test should be + // adjusted accordingly. + planSummary: "unsupported", + currentOpFilter: {"command.comment": "currentop_query_sbe", numYields: {$gt: 0}} + }, + { + test: function(db) { assert.eq(db.currentop_query.findAndModify({ query: {_id: 1, a: 1, $comment: "currentop_query"}, update: {$inc: {b: 1}}, |