summaryrefslogtreecommitdiff
path: root/jstests/concurrency/fsm_utils/setup_teardown_functions.js
blob: f39afb38cb7b4726f0933b5191abcef6f60ab1d4 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'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 increaseDropDistLockTimeoutSCCC = function increaseDropDistLockTimeoutSCCC(db) {
    var waitTimeSecs = 10 * 60; // 10 minutes
    assert.commandWorked(db.runCommand({
        configureFailPoint: 'setSCCCDropCollDistLockWait',
        mode: 'alwaysOn',
        data: { waitForSecs: waitTimeSecs }
    }));
};

var resetDropDistLockTimeoutSCCC = function resetDropDistLockTimeoutSCCC(db) {
    assert.commandWorked(db.runCommand({
        configureFailPoint: 'setSCCCDropCollDistLockWait',
        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'
    }));
};