summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/resumable_index_build_collection_scan_phase.js
blob: 6aa18a03341d92b2043b7c770cc8d1564529b100 (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
/**
 * Tests that resumable index build state is written to disk upon clean shutdown when an index
 * build is in the collection scan phase, and that the index build is subsequently completed when
 * the node is started back up.
 *
 * @tags: [
 *   requires_persistence,
 *   requires_replication,
 * ]
 */
(function() {
"use strict";

load("jstests/noPassthrough/libs/index_build.js");

const dbName = "test";
const failPointName = "hangIndexBuildDuringCollectionScanPhaseBeforeInsertion";

const rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();

const coll = rst.getPrimary().getDB(dbName).getCollection(jsTestName());
assert.commandWorked(coll.insert([{a: 1}, {a: 2}]));

ResumableIndexBuildTest.run(rst, dbName, coll.getName(), {a: 1}, failPointName, {iteration: 0});
ResumableIndexBuildTest.run(rst, dbName, coll.getName(), {a: 1}, failPointName, {iteration: 1});

rst.stopSet();
})();