blob: 69cafb65f58fd1980cea072c2059364369d6309c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/**
* Test that drop view only takes database IX lock.
*
* @tags: [requires_db_locking]
*/
(function() {
"use strict";
load("jstests/libs/check_log.js");
const conn = MongoRunner.runMongod({});
const db = conn.getDB("test");
assert.commandWorked(db.runCommand({insert: "a", documents: [{x: 1}]}));
assert.commandWorked(db.createView("view", "a", []));
assert.commandWorked(
db.adminCommand({configureFailPoint: "hangDuringDropCollection", mode: "alwaysOn"}));
// This only holds a database IX lock.
const awaitDrop =
startParallelShell(() => assert(db.getSiblingDB("test")["view"].drop()), conn.port);
checkLog.contains(conn, "hangDuringDropCollection fail point enabled");
// This takes a database IX lock and should not be blocked.
assert.commandWorked(db.runCommand({insert: "a", documents: [{y: 1}]}));
assert.commandWorked(
db.adminCommand({configureFailPoint: "hangDuringDropCollection", mode: "off"}));
awaitDrop();
MongoRunner.stopMongod(conn);
})();
|