summaryrefslogtreecommitdiff
path: root/jstests/concurrency/fsm_utils/setup_teardown_functions.js
blob: 790bcc938561446552de575041de83152bc294b2 (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
34
35
'use strict';

/**
 * Functions used by runners to set up and tear down their clusters.
 * Each function is called by executeOnMongodNodes and executeOnMongosNodes
 * (if the cluster is sharded). Each function should accept a connection to
 * the 'admin' database.
 */

var increaseDropDistLockTimeout = function increaseDropDistLockTimeout(db) {
    var waitTimeSecs = 10 * 60;  // 10 minutes
    assert.commandWorked(db.runCommand({
        configureFailPoint: 'setDropCollDistLockWait',
        mode: 'alwaysOn',
        data: {waitForSecs: waitTimeSecs}
    }));
};

var resetDropDistLockTimeout = function resetDropDistLockTimeout(db) {
    assert.commandWorked(
        db.runCommand({configureFailPoint: 'setDropCollDistLockWait', mode: 'off'}));
};

var setYieldAllLocksFailPoint = function setYieldAllLocksFailPoint(db) {
    var waitTimeMillis = 20;
    assert.commandWorked(db.runCommand({
        configureFailPoint: 'setYieldAllLocksWait',
        mode: 'alwaysOn',
        data: {waitForMillis: waitTimeMillis}
    }));
};

var resetYieldAllLocksFailPoint = function resetYieldAllLocksFailPoint(db) {
    assert.commandWorked(db.runCommand({configureFailPoint: 'setYieldAllLocksWait', mode: 'off'}));
};