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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/**
* Tests that resumable index builds complete properly after being interrupted for rollback during
* the drain writes 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 = "hangIndexBuildDuringDrainWritesPhase";
const insertsToBeRolledBack = [{a: 13}, {a: 14}];
const rollbackTest = new RollbackTest(jsTestName());
const coll = rollbackTest.getPrimary().getDB(dbName).getCollection(jsTestName());
assert.commandWorked(coll.insert([{a: 1}, {a: 2}, {a: 3}]));
// Rollback to before the index begins to be built.
RollbackResumableIndexBuildTest.run(rollbackTest,
dbName,
coll.getName(),
{a: 1},
rollbackStartFailPointName,
{iteration: 0},
"hangAfterSettingUpIndexBuildUnlocked",
{},
insertsToBeRolledBack,
[{a: 4}, {a: 5}]);
// Rollback to the collection scan phase.
RollbackResumableIndexBuildTest.run(rollbackTest,
dbName,
coll.getName(),
{a: 1},
rollbackStartFailPointName,
{iteration: 0},
"hangIndexBuildDuringCollectionScanPhaseBeforeInsertion",
{fieldsToMatch: {a: 2}},
insertsToBeRolledBack,
[{a: 6}, {a: 7}]);
// Rollback to the bulk load phase.
RollbackResumableIndexBuildTest.run(rollbackTest,
dbName,
coll.getName(),
{a: 1},
rollbackStartFailPointName,
{iteration: 0},
"hangIndexBuildDuringBulkLoadPhase",
{iteration: 1},
insertsToBeRolledBack,
[{a: 8}, {a: 9}]);
// Rollback to earlier in the drain writes phase. We set maxIndexBuildDrainBatchSize to 1 so that
// the primary can step down between iterations.
assert.commandWorked(
rollbackTest.getPrimary().adminCommand({setParameter: 1, maxIndexBuildDrainBatchSize: 1}));
RollbackResumableIndexBuildTest.run(rollbackTest,
dbName,
coll.getName(),
{a: 1},
rollbackStartFailPointName,
{iteration: 2},
"hangIndexBuildDuringDrainWritesPhaseSecond",
{iteration: 0},
insertsToBeRolledBack,
[{a: 10}, {a: 11}, {a: 12}]);
rollbackTest.stop();
})();
|