diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-08-22 21:10:50 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-08-22 21:11:53 -0400 |
commit | d743246d3c0e35c21b4f1d954bc138df60c47a5a (patch) | |
tree | 70b2b18db1bf906d387b752ce176b684a0e8a6b5 /jstests/noPassthrough/lock_stats.js | |
parent | 46522393008ad96af478aa1dd5122ea6e4960889 (diff) | |
download | mongo-d743246d3c0e35c21b4f1d954bc138df60c47a5a.tar.gz |
SERVER-33272 The DatabaseHolder::close() function no longer requires a global write lock and neither does the dropDatabase command.
Diffstat (limited to 'jstests/noPassthrough/lock_stats.js')
-rw-r--r-- | jstests/noPassthrough/lock_stats.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/jstests/noPassthrough/lock_stats.js b/jstests/noPassthrough/lock_stats.js index 1274dd326c4..404f5a589ae 100644 --- a/jstests/noPassthrough/lock_stats.js +++ b/jstests/noPassthrough/lock_stats.js @@ -6,14 +6,19 @@ 'use strict'; function testBlockTime(blockTimeMillis) { + assert.commandWorked(db.getSiblingDB('t1').createCollection('test')); + // Lock the database, and in parallel start an operation that needs the lock, so it blocks. assert.commandWorked(db.fsyncLock()); var startStats = db.serverStatus().locks.Global; var startTime = new Date(); var minBlockedMillis = blockTimeMillis; + // This is just some command that requires a MODE_X global lock that conflicts. - var s = startParallelShell( - 'assert.commandWorked(db.getSiblingDB(\'nonexisting\').dropDatabase());', conn.port); + let awaitRename = startParallelShell(() => { + assert.commandWorked( + db.adminCommand({renameCollection: 't1.test', to: 't2.test', dropTarget: true})); + }, conn.port); // Wait until we see somebody waiting to acquire the lock, defend against unset stats. assert.soon((function() { @@ -32,7 +37,7 @@ function testBlockTime(blockTimeMillis) { db.fsyncUnlock(); // Wait for the parallel shell to finish, so its stats will have been recorded. - s(); + awaitRename(); // The fsync command from the shell cannot have possibly been blocked longer than this. var maxBlockedMillis = new Date() - startTime; |