summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/resumable_index_build_drain_writes_phase.js
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2020-09-24 16:08:04 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-24 20:42:31 +0000
commit268cf87b208dd966c5e017d0219769163c1dacb0 (patch)
tree2e099fdcf8056525ef861ed7fb0a5509083c9d32 /jstests/noPassthrough/resumable_index_build_drain_writes_phase.js
parentbd42ad9710f3665c18f09fe57523a80913570872 (diff)
downloadmongo-268cf87b208dd966c5e017d0219769163c1dacb0.tar.gz
SERVER-50708 Test resuming multiple index builds
Diffstat (limited to 'jstests/noPassthrough/resumable_index_build_drain_writes_phase.js')
-rw-r--r--jstests/noPassthrough/resumable_index_build_drain_writes_phase.js47
1 files changed, 26 insertions, 21 deletions
diff --git a/jstests/noPassthrough/resumable_index_build_drain_writes_phase.js b/jstests/noPassthrough/resumable_index_build_drain_writes_phase.js
index 29d509eff3e..088759a3a81 100644
--- a/jstests/noPassthrough/resumable_index_build_drain_writes_phase.js
+++ b/jstests/noPassthrough/resumable_index_build_drain_writes_phase.js
@@ -1,7 +1,6 @@
/**
- * Tests that resumable index build state is written to disk upon clean shutdown when an index
- * build is in the drain writes phase for a single node replica set, and that the index build is
- * subsequently completed when the node is started back up.
+ * Tests that resumable index builds in the drain writes phase write their state to disk upon clean
+ * shutdown and are resumed from the same phase to completion when the node is started back up.
*
* @tags: [
* requires_majority_read_concern,
@@ -15,37 +14,43 @@
load("jstests/noPassthrough/libs/index_build.js");
const dbName = "test";
-const failPointName = "hangIndexBuildDuringDrainWritesPhase";
const rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
-const runTests = function(docs, indexSpec, sideWrites, collNameSuffix) {
+const runTests = function(docs, indexSpecsFlat, sideWrites, collNameSuffix) {
const coll = rst.getPrimary().getDB(dbName).getCollection(jsTestName() + collNameSuffix);
assert.commandWorked(coll.insert(docs));
- const runTest = function(iteration) {
- ResumableIndexBuildTest.run(rst,
- dbName,
- coll.getName(),
- indexSpec,
- failPointName,
- {iteration: iteration},
- "drain writes",
- {skippedPhaseLogID: 20392},
- sideWrites,
- [{a: 4}, {a: 5}]);
+ const runTest = function(indexSpecs, iteration) {
+ ResumableIndexBuildTest.run(
+ rst,
+ dbName,
+ coll.getName(),
+ indexSpecs,
+ [{name: "hangIndexBuildDuringDrainWritesPhase", logIdWithIndexName: 4841800}],
+ iteration,
+ ["drain writes"],
+ [{skippedPhaseLogID: 20392}],
+ sideWrites,
+ [{a: 4}, {a: 5}]);
};
- runTest(0);
- runTest(1);
+ runTest([[indexSpecsFlat[0]]], 0);
+ runTest([[indexSpecsFlat[0]]], 1);
+ runTest([[indexSpecsFlat[0]], [indexSpecsFlat[1]]], 0);
+ runTest([[indexSpecsFlat[0]], [indexSpecsFlat[1]]], 1);
+ runTest([indexSpecsFlat], 0);
+ runTest([indexSpecsFlat], 1);
};
-runTests({a: 1}, {a: 1}, [{a: 2}, {a: 3}], "");
-runTests({a: [1, 2]}, {a: 1}, [{a: 2}, {a: 3}], "_multikey");
+runTests({a: 1}, [{a: 1}, {b: 1}], [{a: 2, b: 2}, {a: 3, b: 3}], "");
+runTests({a: 1}, [{a: 1}, {b: 1}], [{a: [2, 3], b: [2, 3]}, {a: 3, b: 3}], "_multikey_first");
+runTests({a: 1}, [{a: 1}, {b: 1}], [{a: 2, b: 2}, {a: [3, 4], b: [3, 4]}], "_multikey_last");
+runTests({a: 1}, [{a: 1}, {b: 1}], [{a: [2, 3], b: 2}, {a: 3, b: [3, 4]}], "_multikey_mixed");
runTests({a: 1},
- {"$**": 1},
+ [{"$**": 1}, {h: 1}],
[{a: [1, 2], b: {c: [3, 4]}, d: ""}, {e: "", f: [[]], g: null, h: 8}],
"_wildcard");