summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorIvan Fefer <ivan.fefer@mongodb.com>2022-10-07 07:29:29 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-07 08:02:46 +0000
commit27e71f251ee6a2136d10b895c72391f9c5a12d59 (patch)
treeb0f7c3466f6ca7a22e3f7639898df78ce460f269 /jstests
parent0406b63884d9993f0eafd7d6dcd680e0ecdc1a1f (diff)
downloadmongo-27e71f251ee6a2136d10b895c72391f9c5a12d59.tar.gz
SERVER-70270: Use fail_point_util.js instead of checkLog to wait for failpoint hit
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/txns/speculative_snapshot_includes_all_writes.js24
-rw-r--r--jstests/noPassthrough/commit_quorum.js11
-rw-r--r--jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js10
-rw-r--r--jstests/noPassthrough/current_op_reports_validation_io.js16
-rw-r--r--jstests/noPassthrough/currentop_secondary_slow_op.js19
-rw-r--r--jstests/noPassthrough/drop_database_aborts_in_progress_index_builds.js11
-rw-r--r--jstests/noPassthrough/drop_database_after_stepdown_resets_drop_pending_flag.js9
-rw-r--r--jstests/noPassthrough/dropdatabase_respect_maxtimems.js12
-rw-r--r--jstests/noPassthrough/hybrid_index_with_updates.js41
-rw-r--r--jstests/replsets/hybrid_index_build_majority_commit_quorum_behavior.js22
10 files changed, 69 insertions, 106 deletions
diff --git a/jstests/core/txns/speculative_snapshot_includes_all_writes.js b/jstests/core/txns/speculative_snapshot_includes_all_writes.js
index e5cdda1ce0c..54979b34033 100644
--- a/jstests/core/txns/speculative_snapshot_includes_all_writes.js
+++ b/jstests/core/txns/speculative_snapshot_includes_all_writes.js
@@ -12,6 +12,8 @@
(function() {
"use strict";
+load("jstests/libs/fail_point_util.js");
+
const dbName = "test";
const collName = "speculative_snapshot_includes_all_writes_1";
const collName2 = "speculative_snapshot_includes_all_writes_2";
@@ -44,10 +46,8 @@ let checkReads = (session, collExpected, coll2Expected) => {
assert.sameMembers(coll2Expected, coll2.find().toArray());
};
-// Clear ramlog so checkLog can't find log messages from previous times this fail point was
-// enabled.
-assert.commandWorked(testDB.adminCommand({clearLog: 'global'}));
-
+const failPoint = configureFailPoint(
+ db, "hangAfterCollectionInserts", {collectionNS: testColl2.getFullName(), first_id: "b"});
try {
// The default WC is majority and this test can't satisfy majority writes.
assert.commandWorked(testDB.adminCommand(
@@ -58,20 +58,13 @@ try {
assert.commandWorked(testColl2.insert([{_id: "a"}], {writeConcern: {w: "majority"}}));
jsTest.log("Create the uncommitted write.");
-
- assert.commandWorked(db.adminCommand({
- configureFailPoint: "hangAfterCollectionInserts",
- mode: "alwaysOn",
- data: {collectionNS: testColl2.getFullName()}
- }));
-
const joinHungWrite = startParallelShell(() => {
assert.commandWorked(
db.getSiblingDB("test").speculative_snapshot_includes_all_writes_2.insert(
{_id: "b"}, {writeConcern: {w: "majority"}}));
});
- checkLog.containsJson(db.getMongo(), 20289);
+ failPoint.wait();
jsTest.log("Create a write following the uncommitted write.");
// Note this write must use local write concern; it cannot be majority committed until
@@ -91,11 +84,7 @@ try {
checkReads(defaultSession, [{_id: 0}, {_id: 1}], [{_id: "a"}]);
jsTestLog("Allow the uncommitted write to finish.");
- assert.commandWorked(db.adminCommand({
- configureFailPoint: "hangAfterCollectionInserts",
- mode: "off",
- }));
-
+ failPoint.off();
joinHungWrite();
jsTestLog("Double-checking that writes not committed at start of snapshot cannot appear.");
@@ -121,6 +110,7 @@ try {
localSession.endSession();
defaultSession.endSession();
} finally {
+ failPoint.off();
// Unsetting CWWC is not allowed, so explicitly restore the default write concern to be majority
// by setting CWWC to {w: majority}.
assert.commandWorked(testDB.adminCommand({
diff --git a/jstests/noPassthrough/commit_quorum.js b/jstests/noPassthrough/commit_quorum.js
index 4289d620dc3..dae98e83de5 100644
--- a/jstests/noPassthrough/commit_quorum.js
+++ b/jstests/noPassthrough/commit_quorum.js
@@ -7,6 +7,7 @@
*/
(function() {
load("jstests/noPassthrough/libs/index_build.js");
+load('jstests/libs/fail_point_util.js');
const replSet = new ReplSetTest({
nodes: [
@@ -58,10 +59,8 @@ assert.eq(1, res.commitQuorum);
replSet.awaitReplication();
let awaitShell;
+const failPoint = configureFailPoint(testDB, "hangAfterIndexBuildFirstDrain");
try {
- assert.commandWorked(testDB.adminCommand(
- {configureFailPoint: "hangAfterIndexBuildFirstDrain", mode: "alwaysOn"}));
-
// Starts parallel shell to run the command that will hang.
awaitShell = startParallelShell(function() {
// Use the index builds coordinator for a two-phase index build.
@@ -72,8 +71,7 @@ try {
}));
}, testDB.getMongo().port);
- checkLog.containsWithCount(
- replSet.getPrimary(), "Index build: waiting for index build to complete", 5);
+ failPoint.wait();
// Test setting various commit quorums on the index build in our two node replica set.
assert.commandFailed(testDB.runCommand(
@@ -96,8 +94,7 @@ try {
commitQuorum: "majority"
}));
} finally {
- assert.commandWorked(
- testDB.adminCommand({configureFailPoint: "hangAfterIndexBuildFirstDrain", mode: "off"}));
+ failPoint.off();
}
// Wait for the parallel shell to complete.
diff --git a/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js b/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js
index 6a465fc1d2e..5534c1e650b 100644
--- a/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js
+++ b/jstests/noPassthrough/create_indexes_in_txn_errors_if_already_in_progress.js
@@ -10,6 +10,7 @@
"use strict";
load("jstests/libs/parallel_shell_helpers.js");
+load('jstests/libs/fail_point_util.js');
load('jstests/libs/test_background_ops.js');
const rst = new ReplSetTest({nodes: 1});
@@ -59,8 +60,7 @@ const runFailedIndexBuildInTxn = function(dbName, collName, indexSpec, requestNu
// This allows us to pause index builds on the collection using a fail point.
assert.commandWorked(testColl.insert({a: 1}));
-assert.commandWorked(
- testDB.adminCommand({configureFailPoint: 'hangAfterSettingUpIndexBuild', mode: 'alwaysOn'}));
+const failPoint = configureFailPoint(testDB, 'hangAfterSettingUpIndexBuild');
let joinFirstIndexBuild;
let joinSecondIndexBuild;
try {
@@ -69,8 +69,7 @@ try {
funWithArgs(runSuccessfulIndexBuild, dbName, collName, indexSpecB, 1), primary.port);
jsTest.log("Waiting for first index build to get started...");
- checkLog.contains(primary,
- "Hanging index build due to failpoint 'hangAfterSettingUpIndexBuild'");
+ failPoint.wait();
jsTest.log(
"Starting a parallel shell to run a transaction with a second index build request...");
@@ -80,8 +79,7 @@ try {
// hangAfterSettingUpIndexBuild is preventing the first attempt from completing successfully.
joinSecondIndexBuild();
} finally {
- assert.commandWorked(
- testDB.adminCommand({configureFailPoint: 'hangAfterSettingUpIndexBuild', mode: 'off'}));
+ failPoint.off();
}
joinFirstIndexBuild();
diff --git a/jstests/noPassthrough/current_op_reports_validation_io.js b/jstests/noPassthrough/current_op_reports_validation_io.js
index ba5aedc8b0b..944c5ad832e 100644
--- a/jstests/noPassthrough/current_op_reports_validation_io.js
+++ b/jstests/noPassthrough/current_op_reports_validation_io.js
@@ -5,6 +5,8 @@
* @tags: [requires_fsync, requires_wiredtiger, requires_persistence]
*/
(function() {
+load('jstests/libs/fail_point_util.js');
+
const dbName = "test";
const collName = "currentOpValidation";
@@ -24,13 +26,11 @@ for (let i = 0; i < 5; i++) {
assert.commandWorked(db.adminCommand({setParameter: 1, maxValidateMBperSec: 1}));
// Simulate each record being 512KB.
-assert.commandWorked(db.adminCommand(
- {configureFailPoint: "fixedCursorDataSizeOf512KBForDataThrottle", mode: "alwaysOn"}));
+const cursorDataSizeFailPoint = configureFailPoint(db, "fixedCursorDataSizeOf512KBForDataThrottle");
// This fail point comes after we've traversed the record store, so currentOp should have some
// validation statistics once we hit this fail point.
-assert.commandWorked(
- db.adminCommand({configureFailPoint: "pauseCollectionValidationWithLock", mode: "alwaysOn"}));
+const pauseFailPoint = configureFailPoint(db, "pauseCollectionValidationWithLock");
// Forces a checkpoint to make the background validation see the data.
assert.commandWorked(db.adminCommand({fsync: 1}));
@@ -44,7 +44,7 @@ const awaitValidation = startParallelShell(() => {
}));
}, conn.port);
-checkLog.containsJson(conn, 20304);
+pauseFailPoint.wait();
const curOpFilter = {
'command.validate': collName
@@ -61,10 +61,8 @@ assert(curOp[0].hasOwnProperty("dataThroughputLastSecond") &&
curOp[0].hasOwnProperty("dataThroughputAverage"));
// Finish up validating the collection.
-assert.commandWorked(db.adminCommand(
- {configureFailPoint: "fixedCursorDataSizeOf512KBForDataThrottle", mode: "off"}));
-assert.commandWorked(
- db.adminCommand({configureFailPoint: "pauseCollectionValidationWithLock", mode: "off"}));
+cursorDataSizeFailPoint.off();
+pauseFailPoint.off();
// Setting this to 0 turns off the throttle.
assert.commandWorked(db.adminCommand({setParameter: 1, maxValidateMBperSec: 0}));
diff --git a/jstests/noPassthrough/currentop_secondary_slow_op.js b/jstests/noPassthrough/currentop_secondary_slow_op.js
index 4826b779877..788cae24d17 100644
--- a/jstests/noPassthrough/currentop_secondary_slow_op.js
+++ b/jstests/noPassthrough/currentop_secondary_slow_op.js
@@ -7,6 +7,8 @@
(function() {
"use strict";
+load("jstests/libs/fail_point_util.js");
+
const rst = new ReplSetTest({
nodes: [
{},
@@ -31,18 +33,14 @@ assert.commandWorked(coll.insert({_id: 'a'}));
const secondary = rst.getSecondary();
const secondaryDB = secondary.getDB(testDB.getName());
-assert.commandWorked(secondaryDB.adminCommand({
- configureFailPoint: 'hangAfterCollectionInserts',
- mode: 'alwaysOn',
- data: {
- collectionNS: coll.getFullName(),
- first_id: 'b',
- },
-}));
+const failPoint = configureFailPoint(secondaryDB, 'hangAfterCollectionInserts', {
+ collectionNS: coll.getFullName(),
+ first_id: 'b',
+});
try {
assert.commandWorked(coll.insert({_id: 'b'}));
- checkLog.containsJson(secondary, 20289);
+ failPoint.wait();
jsTestLog('Running currentOp() with slow operation logging.');
// Lower slowms to make currentOp() log slow operation while the secondary is procesing the
@@ -57,8 +55,7 @@ try {
secondaryAdminDB.setProfilingLevel(profileResult.was, {slowms: profileResult.slowms}));
jsTestLog('Completed currentOp() with slow operation logging.');
} finally {
- assert.commandWorked(
- secondaryDB.adminCommand({configureFailPoint: 'hangAfterCollectionInserts', mode: 'off'}));
+ failPoint.off();
}
rst.stopSet();
diff --git a/jstests/noPassthrough/drop_database_aborts_in_progress_index_builds.js b/jstests/noPassthrough/drop_database_aborts_in_progress_index_builds.js
index dbfa048241a..a5d5908cfec 100644
--- a/jstests/noPassthrough/drop_database_aborts_in_progress_index_builds.js
+++ b/jstests/noPassthrough/drop_database_aborts_in_progress_index_builds.js
@@ -6,6 +6,7 @@
"use strict";
load("jstests/noPassthrough/libs/index_build.js");
+load("jstests/libs/fail_point_util.js");
const mongodOptions = {};
const conn = MongoRunner.runMongod(mongodOptions);
@@ -47,8 +48,7 @@ IndexBuildTest.waitForIndexBuildToScanCollection(testDB, secondCollName, "b_1");
jsTest.log("Dropping database " + dbName + " with in-progress index builds on its collections.");
-assert.commandWorked(testDB.adminCommand(
- {configureFailPoint: 'dropDatabaseHangAfterWaitingForIndexBuilds', mode: 'alwaysOn'}));
+const failPoint = configureFailPoint(testDB, 'dropDatabaseHangAfterWaitingForIndexBuilds');
const awaitDropDatabase = startParallelShell(() => {
const testDB = db.getSiblingDB(TestData.dbName);
@@ -60,9 +60,7 @@ try {
"About to abort all index builders running for collections in the given database");
IndexBuildTest.resumeIndexBuilds(testDB.getMongo());
- checkLog.contains(
- testDB.getMongo(),
- "dropDatabase - fail point dropDatabaseHangAfterWaitingForIndexBuilds enabled");
+ failPoint.wait();
// Cannot create a collection on the database while it is drop pending.
assert.commandFailedWithCode(testDB.createCollection("third"), ErrorCodes.DatabaseDropPending);
@@ -79,8 +77,7 @@ try {
}
} finally {
IndexBuildTest.resumeIndexBuilds(testDB.getMongo());
- testDB.adminCommand(
- {configureFailPoint: 'dropDatabaseHangAfterWaitingForIndexBuilds', mode: 'off'});
+ failPoint.off();
}
awaitFirstIndexBuild();
diff --git a/jstests/noPassthrough/drop_database_after_stepdown_resets_drop_pending_flag.js b/jstests/noPassthrough/drop_database_after_stepdown_resets_drop_pending_flag.js
index e531a9537b3..898ffd49c61 100644
--- a/jstests/noPassthrough/drop_database_after_stepdown_resets_drop_pending_flag.js
+++ b/jstests/noPassthrough/drop_database_after_stepdown_resets_drop_pending_flag.js
@@ -11,6 +11,7 @@
"use strict";
load('jstests/noPassthrough/libs/index_build.js');
+load("jstests/libs/fail_point_util.js");
const rst = new ReplSetTest({
nodes: [
@@ -26,8 +27,7 @@ const primary = rst.getPrimary();
const testDB = primary.getDB('test');
const coll = testDB.getCollection('test');
-assert.commandWorked(testDB.adminCommand(
- {configureFailPoint: 'dropDatabaseHangAfterWaitingForIndexBuilds', mode: 'alwaysOn'}));
+const failPoint = configureFailPoint(testDB, 'dropDatabaseHangAfterWaitingForIndexBuilds');
assert.commandWorked(coll.insert({a: 1}));
@@ -45,7 +45,7 @@ let awaitDropDatabase = startParallelShell(() => {
ErrorCodes.InterruptedDueToReplStateChange);
}, primary.port);
-checkLog.containsJson(primary, 4612300);
+failPoint.wait();
assert.commandWorked(testDB.adminCommand({clearLog: "global"}));
let awaitStepDown = startParallelShell(() => {
@@ -55,8 +55,7 @@ let awaitStepDown = startParallelShell(() => {
IndexBuildTest.resumeIndexBuilds(primary);
checkLog.containsJson(primary, 21344);
-assert.commandWorked(testDB.adminCommand(
- {configureFailPoint: 'dropDatabaseHangAfterWaitingForIndexBuilds', mode: 'off'}));
+failPoint.off();
awaitIndexBuild();
awaitDropDatabase();
diff --git a/jstests/noPassthrough/dropdatabase_respect_maxtimems.js b/jstests/noPassthrough/dropdatabase_respect_maxtimems.js
index ef60ceb55c4..21ea0c939ec 100644
--- a/jstests/noPassthrough/dropdatabase_respect_maxtimems.js
+++ b/jstests/noPassthrough/dropdatabase_respect_maxtimems.js
@@ -3,6 +3,7 @@
* @tags: [requires_replication, uses_transactions]
*/
(function() {
+load("jstests/libs/fail_point_util.js");
load("jstests/libs/wait_for_command.js");
const rst = ReplSetTest({nodes: 1});
rst.startSet();
@@ -26,8 +27,8 @@ const dropDB = rst.getPrimary().getDB("drop");
(function assertDatabaseDropCanBeInterrupted() {
assert.commandWorked(dropDB.bar.insert({}));
- assert.commandWorked(rst.getPrimary().adminCommand(
- {configureFailPoint: "dropDatabaseHangAfterAllCollectionsDrop", mode: "alwaysOn"}));
+ const failPoint =
+ configureFailPoint(rst.getPrimary(), "dropDatabaseHangAfterAllCollectionsDrop");
// This will get blocked by the failpoint when collection drop phase finishes.
let dropDatabaseShell = startParallelShell(() => {
@@ -36,9 +37,7 @@ const dropDB = rst.getPrimary().getDB("drop");
ErrorCodes.MaxTimeMSExpired);
}, rst.getPrimary().port);
- checkLog.contains(
- dropDB.getMongo(),
- "dropDatabase - fail point dropDatabaseHangAfterAllCollectionsDrop enabled. Blocking until fail point is disabled");
+ failPoint.wait();
let sleepCommand = startParallelShell(() => {
// Make dropDatabase timeout.
@@ -52,8 +51,7 @@ const dropDB = rst.getPrimary().getDB("drop");
// dropDatabase now gets unblocked by the failpoint but will immediately
// get blocked by acquiring the database lock for dropping the database.
- assert.commandWorked(rst.getPrimary().adminCommand(
- {configureFailPoint: "dropDatabaseHangAfterAllCollectionsDrop", mode: "off"}));
+ failPoint.off();
dropDatabaseShell();
diff --git a/jstests/noPassthrough/hybrid_index_with_updates.js b/jstests/noPassthrough/hybrid_index_with_updates.js
index febc66755d4..0e4641ed83a 100644
--- a/jstests/noPassthrough/hybrid_index_with_updates.js
+++ b/jstests/noPassthrough/hybrid_index_with_updates.js
@@ -6,18 +6,11 @@
(function() {
"use strict";
+load("jstests/libs/fail_point_util.js");
+
let conn = MongoRunner.runMongod();
let testDB = conn.getDB('test');
-let turnFailPointOn = function(failPointName, data) {
- assert.commandWorked(testDB.adminCommand(
- {configureFailPoint: failPointName, mode: "alwaysOn", data: data || {}}));
-};
-
-let turnFailPointOff = function(failPointName) {
- assert.commandWorked(testDB.adminCommand({configureFailPoint: failPointName, mode: "off"}));
-};
-
let totalDocs = 0;
let crudOpsForPhase = function(coll, phase) {
let bulk = coll.initializeUnorderedBulkOp();
@@ -53,7 +46,8 @@ crudOpsForPhase(testDB.hybrid, 0);
assert.eq(totalDocs, testDB.hybrid.count());
// Hang the build after the first document.
-turnFailPointOn("hangIndexBuildDuringCollectionScanPhaseBeforeInsertion", {fieldsToMatch: {i: 1}});
+const collScanFailPoint = configureFailPoint(
+ testDB, "hangIndexBuildDuringCollectionScanPhaseBeforeInsertion", {fieldsToMatch: {i: 1}});
// Start the background build.
let bgBuild = startParallelShell(function() {
@@ -73,49 +67,50 @@ crudOpsForPhase(testDB.hybrid, 1);
assert.eq(totalDocs, testDB.hybrid.count());
// Enable pause after bulk dump into index.
-turnFailPointOn("hangAfterIndexBuildDumpsInsertsFromBulk");
+const insertDumpFailPoint = configureFailPoint(testDB, "hangAfterIndexBuildDumpsInsertsFromBulk");
// Wait for the bulk insert to complete.
-turnFailPointOff("hangIndexBuildDuringCollectionScanPhaseBeforeInsertion");
-checkLog.contains(conn, "Hanging after dumping inserts from bulk builder");
+collScanFailPoint.off();
+insertDumpFailPoint.wait();
// Phase 2: First drain
// Do some updates, inserts and deletes after the bulk builder has finished.
// Hang after yielding
-turnFailPointOn("hangDuringIndexBuildDrainYield", {namespace: testDB.hybrid.getFullName()});
+const yieldFailPoint = configureFailPoint(
+ testDB, "hangDuringIndexBuildDrainYield", {namespace: testDB.hybrid.getFullName()});
// Enable pause after first drain.
-turnFailPointOn("hangAfterIndexBuildFirstDrain");
+const firstDrainFailPoint = configureFailPoint(testDB, "hangAfterIndexBuildFirstDrain");
crudOpsForPhase(testDB.hybrid, 2);
assert.eq(totalDocs, testDB.hybrid.count());
// Allow first drain to start.
-turnFailPointOff("hangAfterIndexBuildDumpsInsertsFromBulk");
+insertDumpFailPoint.off();
// Ensure the operation yields during the drain, then attempt some operations.
-checkLog.contains(conn, "Hanging index build during drain yield");
+yieldFailPoint.wait();
assert.commandWorked(testDB.hybrid.insert({i: "during yield"}));
assert.commandWorked(testDB.hybrid.remove({i: "during yield"}));
-turnFailPointOff("hangDuringIndexBuildDrainYield");
+yieldFailPoint.off();
// Wait for first drain to finish.
-checkLog.contains(conn, "Hanging after index build first drain");
+firstDrainFailPoint.wait();
// Phase 3: Second drain
// Enable pause after second drain.
-turnFailPointOn("hangAfterIndexBuildSecondDrain");
+const secondDrainFailPoint = configureFailPoint(testDB, "hangAfterIndexBuildSecondDrain");
// Add inserts that must be consumed in the second drain.
crudOpsForPhase(testDB.hybrid, 3);
assert.eq(totalDocs, testDB.hybrid.count());
// Allow second drain to start.
-turnFailPointOff("hangAfterIndexBuildFirstDrain");
+firstDrainFailPoint.off();
// Wait for second drain to finish.
-checkLog.contains(conn, "Hanging after index build second drain");
+secondDrainFailPoint.wait();
// Phase 4: Final drain and commit.
// Add inserts that must be consumed in the final drain.
@@ -123,7 +118,7 @@ crudOpsForPhase(testDB.hybrid, 4);
assert.eq(totalDocs, testDB.hybrid.count());
// Allow final drain to start.
-turnFailPointOff("hangAfterIndexBuildSecondDrain");
+secondDrainFailPoint.off();
// Wait for build to complete.
bgBuild();
diff --git a/jstests/replsets/hybrid_index_build_majority_commit_quorum_behavior.js b/jstests/replsets/hybrid_index_build_majority_commit_quorum_behavior.js
index 3dce73aae49..b77dee1b6d9 100644
--- a/jstests/replsets/hybrid_index_build_majority_commit_quorum_behavior.js
+++ b/jstests/replsets/hybrid_index_build_majority_commit_quorum_behavior.js
@@ -5,6 +5,7 @@
(function() {
"use strict";
+load("jstests/libs/fail_point_util.js");
load("jstests/replsets/rslib.js");
load('jstests/noPassthrough/libs/index_build.js');
@@ -53,14 +54,6 @@ function sanityChecks() {
IndexBuildTest.assertIndexes(primaryColl, 2, ['_id_'], ['x_1']);
}
-function pauseIndexBuild(conn, failpoint) {
- assert.commandWorked(conn.adminCommand({configureFailPoint: failpoint, mode: 'alwaysOn'}));
-}
-
-function resumeIndexBuild(conn, failpoint) {
- assert.commandWorked(conn.adminCommand({configureFailPoint: failpoint, mode: 'off'}));
-}
-
function createIndex(dbName, collName, indexName) {
jsTestLog("Create index '" + indexName + "'.");
assert.commandWorked(db.getSiblingDB(dbName).runCommand({
@@ -71,23 +64,24 @@ function createIndex(dbName, collName, indexName) {
}
// Make secondary index build to hang after collection scan phase.
-pauseIndexBuild(secondary, "hangAfterIndexBuildDumpsInsertsFromBulk");
+const insertDumpFailPoint =
+ configureFailPoint(secondary, "hangAfterIndexBuildDumpsInsertsFromBulk");
// Start the index build on primary in parallel shell.
const joinCreateIndexThread =
startParallelShell(funWithArgs(createIndex, dbName, collName, indexName), primary.port);
jsTestLog("Waiting for Collection scan phase to complete");
-checkLog.contains(secondary, "Hanging after dumping inserts from bulk builder");
+insertDumpFailPoint.wait();
sanityChecks();
-pauseIndexBuild(secondary, "hangAfterIndexBuildFirstDrain");
-resumeIndexBuild(secondary, "hangAfterIndexBuildDumpsInsertsFromBulk");
+const firstDrainFailPoint = configureFailPoint(secondary, "hangAfterIndexBuildFirstDrain");
+insertDumpFailPoint.off();
jsTestLog("Waiting for first drain phase to complete");
-checkLog.contains(secondary, "Hanging after index build first drain");
+firstDrainFailPoint.wait();
sanityChecks();
// Make secondary to resume index build. This should allow secondary to vote
// and make primary to commit index build.
-resumeIndexBuild(secondary, "hangAfterIndexBuildFirstDrain");
+firstDrainFailPoint.off();
jsTestLog("Wait for create index thread to join");
joinCreateIndexThread();