summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Grebennicov <denis.grebennicov@mongodb.com>2022-12-15 13:03:32 +0100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-12-15 12:39:00 +0000
commitc4ce50093e9fcd603a2311aaa47fc04d536bf44f (patch)
tree62aac4d5a4c2f70b7440d9049956fbd03858ff97
parentd4ab3fcbfd696c615012f38f0f004cea19d88cc7 (diff)
downloadmongo-c4ce50093e9fcd603a2311aaa47fc04d536bf44f.tar.gz
SERVER-66337 Ensure that check for the interrupt is done on every getNext() call in datasize_kill_op.js
-rw-r--r--jstests/noPassthrough/datasize_kill_op.js (renamed from jstests/noPassthroughWithMongod/datasize_kill_op.js)23
1 files changed, 20 insertions, 3 deletions
diff --git a/jstests/noPassthroughWithMongod/datasize_kill_op.js b/jstests/noPassthrough/datasize_kill_op.js
index e034aa630ed..ad7b435ca2e 100644
--- a/jstests/noPassthroughWithMongod/datasize_kill_op.js
+++ b/jstests/noPassthrough/datasize_kill_op.js
@@ -8,17 +8,29 @@ load("jstests/libs/fail_point_util.js"); // For configureFailPoint.
load("jstests/libs/wait_for_command.js"); // For waitForCommand.
load("jstests/libs/parallel_shell_helpers.js"); // For funWithArgs.
+const mongodOptions = {};
+const conn = MongoRunner.runMongod(mongodOptions);
+assert.neq(null, conn, `mongod failed to start with options ${tojson(mongodOptions)}`);
+
+const dbName = `${jsTest.name()}_db`;
+const db = conn.getDB(dbName);
+assert.commandWorked(db.dropDatabase());
+assert.commandWorked(db.createCollection("foo"));
+
const coll = db.foo;
coll.drop();
coll.insert({_id: 0, s: "asdasdasdasdasdasdasd"});
const dataSizeCommand = {
- "dataSize": "test.foo",
+ "dataSize": dbName + ".foo",
"keyPattern": {"_id": 1},
"min": {"_id": 0},
"max": {"_id": 1}
};
+// Set the yield iterations to 1 such that on every getNext() call we check for yield or interrupt.
+assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1}));
+
// Configure the failpoint.
const failpoint = configureFailPoint(db, "hangBeforeDatasizeCount");
@@ -30,12 +42,17 @@ const awaitShell =
failpoint.wait();
// Find the command opid and kill it.
-const opId = waitForCommand("dataSizeCmd", op => (op["command"]["dataSize"] == "test.foo"), db);
+const opId =
+ waitForCommand("dataSizeCmd", op => (op["command"]["dataSize"] == dbName + ".foo"), db);
assert.commandWorked(db.killOp(opId));
// The command is not killed just yet. It will be killed, after releasing the failpoint.
-assert.neq(waitForCommand("dataSizeCmd", op => (op["command"]["dataSize"] == "test.foo"), db), -1);
+assert.neq(waitForCommand("dataSizeCmd", op => (op["command"]["dataSize"] == dbName + ".foo"), db),
+ -1);
failpoint.off();
awaitShell();
+
+assert.commandWorked(db.dropDatabase());
+MongoRunner.stopMongod(conn);
})();