summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Jin Kang Park <yujin.kang@mongodb.com>2022-03-16 16:31:22 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-16 17:04:41 +0000
commitb93f3757801f1b452391b8e3c277d092bd0fe835 (patch)
tree652b0c1f0a384c0fae743775557abd4e52e7f468
parentfd26d99c7700fcb4d7a8bfc0153ff425a389e0c4 (diff)
downloadmongo-b93f3757801f1b452391b8e3c277d092bd0fe835.tar.gz
SERVER-64556 Fix coll_mod_takes_collection_x_lock.js collection name collision failure
-rw-r--r--jstests/noPassthroughWithMongod/coll_mod_takes_collection_x_lock.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/jstests/noPassthroughWithMongod/coll_mod_takes_collection_x_lock.js b/jstests/noPassthroughWithMongod/coll_mod_takes_collection_x_lock.js
index 46b055209db..676078864d6 100644
--- a/jstests/noPassthroughWithMongod/coll_mod_takes_collection_x_lock.js
+++ b/jstests/noPassthroughWithMongod/coll_mod_takes_collection_x_lock.js
@@ -4,19 +4,26 @@
(function() {
'use strict';
+load('jstests/libs/parallel_shell_helpers.js');
+
// Note: failpoint name may not be changed due to backwards compatibility problem in
// multiversion suites running JS tests using the failpoint.
// In reality this hangs after acquiring a collection MODE_X lock (w/ database MODE_IX)."
const failpoint = 'hangAfterDatabaseLock';
assert.commandWorked(db.adminCommand({configureFailPoint: failpoint, mode: "alwaysOn"}));
+const collectionName = jsTestName();
+
const conn = db.getMongo();
-assert.commandWorked(db.createCollection('foo'));
+const coll = db.getCollection(collectionName);
+coll.drop();
+assert.commandWorked(db.createCollection(collectionName));
// Run a no-op collMod command.
-const awaitParallelShell = startParallelShell(() => {
- assert.commandWorked(db.runCommand({collMod: 'foo'}));
-}, conn.port);
+const awaitParallelShell =
+ startParallelShell(funWithArgs((collectionName) => {
+ assert.commandWorked(db.runCommand({collMod: collectionName}));
+ }, collectionName), conn.port);
// Check that the Collection MODE_X lock is being held by checking in lockInfo.
assert.soon(() => {
@@ -24,7 +31,8 @@ assert.soon(() => {
for (let i = 0; i < lockInfo.length; i++) {
let resourceId = lockInfo[i].resourceId;
const mode = lockInfo[i].granted[0].mode;
- if (resourceId.includes("Collection") && resourceId.includes("test.foo") && mode === "X") {
+ if (resourceId.includes("Collection") && resourceId.includes("test." + collectionName) &&
+ mode === "X") {
return true;
}
}