summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2020-04-23 14:39:13 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-23 18:51:40 +0000
commit66783cb504c25061b00c03fe55b70e3ca4125ed5 (patch)
treefa1e68c3f147d42134f5e54e50d6d0a33a323afe /jstests
parent7cde21f53367705a06e7580d63648938ea688a1d (diff)
downloadmongo-66783cb504c25061b00c03fe55b70e3ca4125ed5.tar.gz
SERVER-47605 Single-phase index builds should only check constraint violations upon completion
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthrough/index_stepdown_abort_prepare_conflict.js6
-rw-r--r--jstests/noPassthrough/index_stepdown_after_init.js7
-rw-r--r--jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js15
3 files changed, 13 insertions, 15 deletions
diff --git a/jstests/noPassthrough/index_stepdown_abort_prepare_conflict.js b/jstests/noPassthrough/index_stepdown_abort_prepare_conflict.js
index b79f3ed2868..1822a0ac421 100644
--- a/jstests/noPassthrough/index_stepdown_abort_prepare_conflict.js
+++ b/jstests/noPassthrough/index_stepdown_abort_prepare_conflict.js
@@ -38,12 +38,6 @@ const primary = rst.getPrimary();
const primaryDB = primary.getDB(dbName);
const primaryColl = primaryDB[collName];
-if (!IndexBuildTest.supportsTwoPhaseIndexBuild(primary)) {
- jsTestLog("Skipping test because two-phase index builds are not enabled");
- rst.stopSet();
- return;
-}
-
// This will cause the index build to fail with a CannotIndexParallelArrays error.
assert.commandWorked(
primaryColl.insert({_id: 1, x: [1, 2], y: [1, 2]}, {"writeConcern": {"w": 1}}));
diff --git a/jstests/noPassthrough/index_stepdown_after_init.js b/jstests/noPassthrough/index_stepdown_after_init.js
index 06ca032c21e..9590f41d3ed 100644
--- a/jstests/noPassthrough/index_stepdown_after_init.js
+++ b/jstests/noPassthrough/index_stepdown_after_init.js
@@ -63,12 +63,9 @@ const exitCode = createIdx({checkExitSuccess: false});
assert.neq(0, exitCode, 'expected shell to exit abnormally due to index build being terminated');
if (!IndexBuildTest.supportsTwoPhaseIndexBuild(primary)) {
- // Wait for the IndexBuildCoordinator thread, not the command thread, to report the index build
- // as failed.
+ // Wait for the index build to be unregistred.
if (isJsonLog(primary)) {
- checkLog.containsJson(primary, 20649, {
- nss: coll.getFullName(),
- });
+ checkLog.containsJson(primary, 4656004);
} else {
checkLog.contains(primary, '[IndexBuildsCoordinatorMongod-0] Index build failed: ');
}
diff --git a/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js b/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js
index 8214a20ea06..1bd5be0f94f 100644
--- a/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js
+++ b/jstests/noPassthroughWithMongod/create_indexes_waits_for_already_in_progress.js
@@ -99,11 +99,11 @@ function runFailedIndexBuild(dbName, collName, indexSpec, requestNumber) {
const res = db.getSiblingDB(dbName).runCommand({createIndexes: collName, indexes: [indexSpec]});
jsTest.log("Index build request " + requestNumber +
", expected to fail, result: " + tojson(res));
- assert.commandFailedWithCode(res, ErrorCodes.InternalError);
+ assert.commandFailedWithCode(res, 4698903);
}
assert.commandWorked(
- testDB.adminCommand({configureFailPoint: 'hangAndThenFailIndexBuild', mode: 'alwaysOn'}));
+ testDB.adminCommand({configureFailPoint: 'hangAfterSettingUpIndexBuild', mode: 'alwaysOn'}));
let joinFailedIndexBuild;
let joinSuccessfulIndexBuild;
try {
@@ -113,7 +113,7 @@ try {
jsTest.log("Waiting for third index build to get started...");
checkLog.contains(db.getMongo(),
- "Hanging index build due to failpoint 'hangAndThenFailIndexBuild'");
+ "Hanging index build due to failpoint 'hangAfterSettingUpIndexBuild'");
jsTest.log("Starting a parallel shell to run fourth index build request...");
joinSuccessfulIndexBuild = startParallelShell(
@@ -122,9 +122,13 @@ try {
jsTest.log("Waiting for fourth index build request to wait behind the third...");
checkLog.contains(db.getMongo(),
"but found that at least one of the indexes is already being built");
+
+ jsTest.log("Failing third index build");
+ assert.commandWorked(
+ testDB.adminCommand({configureFailPoint: 'failIndexBuildOnCommit', mode: {times: 1}}));
} finally {
assert.commandWorked(
- testDB.adminCommand({configureFailPoint: 'hangAndThenFailIndexBuild', mode: 'off'}));
+ testDB.adminCommand({configureFailPoint: 'hangAfterSettingUpIndexBuild', mode: 'off'}));
}
// The second request stalled behind the first, so now all we need to do is check that they both
@@ -132,6 +136,9 @@ try {
joinFailedIndexBuild();
joinSuccessfulIndexBuild();
+assert.commandWorked(
+ testDB.adminCommand({configureFailPoint: 'failIndexBuildOnCommit', mode: 'off'}));
+
// Make sure the parallel shells sucessfully built the index. We should now have the _id index,
// the 'the_b_1_index' index and the 'the_c_1_index' just built in the parallel shells.
assert.eq(testColl.getIndexes().length, 3);