diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-10-25 13:16:01 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-25 13:16:01 +0000 |
commit | 4f0c0ed93f0472f79567c71a082dcd7543b4273c (patch) | |
tree | 11d455e9ada1e6ad1971bb22752dc2653e545107 | |
parent | 888f7e6fc10ccb999be203b8cbad4dbe19d0a5d2 (diff) | |
download | mongo-4f0c0ed93f0472f79567c71a082dcd7543b4273c.tar.gz |
SERVER-44239 Ensure the parallel shell in lock_stats.js finishes successfully to record the server status properly
-rw-r--r-- | jstests/noPassthrough/lock_stats.js | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/jstests/noPassthrough/lock_stats.js b/jstests/noPassthrough/lock_stats.js index 8667ba40cb6..dd6000e16b2 100644 --- a/jstests/noPassthrough/lock_stats.js +++ b/jstests/noPassthrough/lock_stats.js @@ -5,22 +5,6 @@ (function() { 'use strict'; -const waitForCommand = function(waitingFor, opFilter) { - let opId = -1; - assert.soon(function() { - print(`Checking for ${waitingFor}`); - const curopRes = db.getSiblingDB("admin").currentOp(); - assert.commandWorked(curopRes); - const foundOp = curopRes["inprog"].filter(opFilter); - - if (foundOp.length == 1) { - opId = foundOp[0]["opid"]; - } - return (foundOp.length == 1); - }); - return opId; -}; - function testBlockTime(blockTimeMillis) { // Lock the database, and in parallel start an operation that needs the lock, so it blocks. assert.commandWorked(db.fsyncLock()); @@ -29,9 +13,8 @@ function testBlockTime(blockTimeMillis) { var minBlockedMillis = blockTimeMillis; let awaitSleepCmd = startParallelShell(() => { - assert.commandFailedWithCode( - db.adminCommand({sleep: 1, secs: 500, lock: "w", $comment: "Lock sleep"}), - ErrorCodes.Interrupted); + assert.commandWorked( + db.adminCommand({sleep: 1, millis: 100, lock: "w", $comment: "Lock sleep"})); }, conn.port); // Wait until we see somebody waiting to acquire the lock, defend against unset stats. @@ -46,16 +29,10 @@ function testBlockTime(blockTimeMillis) { return stats.acquireWaitCount.W > startStats.acquireWaitCount.W; })); - const sleepID = waitForCommand( - "sleepCmd", op => (op["ns"] == "admin.$cmd" && op["command"]["$comment"] == "Lock sleep")); - // Sleep for minBlockedMillis, so the acquirer would have to wait at least that long. sleep(minBlockedMillis); db.fsyncUnlock(); - // Interrupt the sleep command. - assert.commandWorked(db.getSiblingDB("admin").killOp(sleepID)); - awaitSleepCmd(); // The fsync command from the shell cannot have possibly been blocked longer than this. |