diff options
Diffstat (limited to 'jstests/noPassthrough/view_catalog_deadlock_with_rename.js')
-rw-r--r-- | jstests/noPassthrough/view_catalog_deadlock_with_rename.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/jstests/noPassthrough/view_catalog_deadlock_with_rename.js b/jstests/noPassthrough/view_catalog_deadlock_with_rename.js index ec6e6dd107c..ec3aa9d21fd 100644 --- a/jstests/noPassthrough/view_catalog_deadlock_with_rename.js +++ b/jstests/noPassthrough/view_catalog_deadlock_with_rename.js @@ -7,30 +7,30 @@ * The fix is to always lock 'system.views' collection in the end. */ (function() { - 'use strict'; +'use strict'; - const conn = MongoRunner.runMongod(); - const db = conn.getDB('test'); +const conn = MongoRunner.runMongod(); +const db = conn.getDB('test'); - assert.commandWorked(db.runCommand({insert: 'a', documents: [{x: 1}]})); - assert.commandWorked(db.runCommand({insert: 'b', documents: [{x: 1}]})); +assert.commandWorked(db.runCommand({insert: 'a', documents: [{x: 1}]})); +assert.commandWorked(db.runCommand({insert: 'b', documents: [{x: 1}]})); - assert.commandWorked(db.createView('viewA', 'a', [])); +assert.commandWorked(db.createView('viewA', 'a', [])); - // Will cause a view catalog reload. - assert.commandWorked(db.runCommand( - {insert: 'system.views', documents: [{_id: 'test.viewB', viewOn: 'b', pipeline: []}]})); +// Will cause a view catalog reload. +assert.commandWorked(db.runCommand( + {insert: 'system.views', documents: [{_id: 'test.viewB', viewOn: 'b', pipeline: []}]})); - const renameSystemViews = startParallelShell(function() { - // This used to first lock 'test.system.views' and then 'test.aaabb' in X mode. - assert.commandWorked( - db.adminCommand({renameCollection: 'test.system.views', to: 'test.aaabb'})); - }, conn.port); +const renameSystemViews = startParallelShell(function() { + // This used to first lock 'test.system.views' and then 'test.aaabb' in X mode. + assert.commandWorked( + db.adminCommand({renameCollection: 'test.system.views', to: 'test.aaabb'})); +}, conn.port); - // This triggers view catalog reload. Therefore it first locked 'test.aaabb' in IX mode and then - // 'test.system.views' in IS mode. - assert.commandWorked(db.runCommand({delete: 'aaabb', deletes: [{q: {x: 2}, limit: 1}]})); +// This triggers view catalog reload. Therefore it first locked 'test.aaabb' in IX mode and then +// 'test.system.views' in IS mode. +assert.commandWorked(db.runCommand({delete: 'aaabb', deletes: [{q: {x: 2}, limit: 1}]})); - renameSystemViews(); - MongoRunner.stopMongod(conn); +renameSystemViews(); +MongoRunner.stopMongod(conn); })(); |