summaryrefslogtreecommitdiff
path: root/jstests/replsets/rollback_resumable_index_build_collection_scan_phase.js
blob: 23807d853831efbe3b4c6c50fb606bada722c78c (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
/**
 * Tests that resumable index builds complete properly after being interrupted for rollback during
 * the collection scan phase.
 *
 * @tags: [
 *   requires_fcv_47,
 *   requires_majority_read_concern,
 *   requires_persistence,
 * ]
 */
(function() {
"use strict";

load('jstests/replsets/libs/rollback_resumable_index_build.js');

// TODO(SERVER-50775): Re-enable when stepdown issues are fixed in resumable index rollback tests.
if (true) {
    jsTestLog('Skipping test.');
    return;
}

const dbName = "test";
const rollbackStartFailPointName = "hangIndexBuildDuringCollectionScanPhaseBeforeInsertion";
const insertsToBeRolledBack = [{a: 6}, {a: 7}];

const rollbackTest = new RollbackTest(jsTestName());
const coll = rollbackTest.getPrimary().getDB(dbName).getCollection(jsTestName());

assert.commandWorked(coll.insert([{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}]));

// Rollback to before the index begins to be built.
RollbackResumableIndexBuildTest.run(rollbackTest,
                                    dbName,
                                    coll.getName(),
                                    {a: 1},
                                    rollbackStartFailPointName,
                                    {fieldsToMatch: {a: 2}},
                                    "hangAfterSettingUpIndexBuildUnlocked",
                                    {},
                                    insertsToBeRolledBack);

// Rollback to earlier in the collection scan phase.
RollbackResumableIndexBuildTest.run(rollbackTest,
                                    dbName,
                                    coll.getName(),
                                    {a: 1},
                                    rollbackStartFailPointName,
                                    {iteration: 4},
                                    "hangIndexBuildDuringCollectionScanPhaseAfterInsertion",
                                    {iteration: 2},
                                    insertsToBeRolledBack);

rollbackTest.stop();
})();