diff options
author | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2019-08-29 01:13:39 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-08-29 01:13:39 +0000 |
commit | 1ea3fcc30ca036028b9f7527252bb55911c97f54 (patch) | |
tree | 27e7c26fe5b3a99f625bb2ee433c85bc4e412f20 /jstests/noPassthrough/view_catalog_deadlock_with_rename.js | |
parent | 011c365698ac3a60dc901f4f17c71f12e56edd07 (diff) | |
download | mongo-1ea3fcc30ca036028b9f7527252bb55911c97f54.tar.gz |
SERVER-41947 Disallow using the system.views collection name as the source or target names in the rename command
(cherry picked from commit 18f95f8ad46c685d8529dba2d5655b3e4ef968c1)
Diffstat (limited to 'jstests/noPassthrough/view_catalog_deadlock_with_rename.js')
-rw-r--r-- | jstests/noPassthrough/view_catalog_deadlock_with_rename.js | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/jstests/noPassthrough/view_catalog_deadlock_with_rename.js b/jstests/noPassthrough/view_catalog_deadlock_with_rename.js deleted file mode 100644 index ec3aa9d21fd..00000000000 --- a/jstests/noPassthrough/view_catalog_deadlock_with_rename.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This test demonstrates the deadlock we found in SERVER-40994: Rename locks - * the source and target based on their resourceId order, and a delete op on an - * non-existent collection (which also triggers a view catalog reload) locks the - * same two namespaces in different order. - * - * The fix is to always lock 'system.views' collection in the end. - */ -(function() { -'use strict'; - -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.createView('viewA', 'a', [])); - -// 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); - -// 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); -})(); |