diff --git a/jstests/noPassthrough/index_killop_after_stepdown.js b/jstests/noPassthrough/index_killop_after_stepdown.js
|
index 67841202c0..df2a2fcbb0 100644
|
--- a/jstests/noPassthrough/index_killop_after_stepdown.js
|
+++ b/jstests/noPassthrough/index_killop_after_stepdown.js
|
@@ -31,7 +31,7 @@ let res = assert.commandWorked(primary.adminCommand(
|
const hangAfterInitFailpointTimesEntered = res.count;
|
|
res = assert.commandWorked(primary.adminCommand(
|
- {configureFailPoint: 'hangBeforeIndexBuildAbortOnInterrupt', mode: 'alwaysOn'}));
|
+ {configureFailPoint: 'hangAfterIndexBuildAbortOnInterrupt', mode: 'alwaysOn'}));
|
const hangBeforeAbortFailpointTimesEntered = res.count;
|
|
const createIdx = IndexBuildTest.startIndexBuild(primary, coll.getFullName(), {a: 1});
|
@@ -57,7 +57,7 @@ try {
|
|
// Wait for the command thread to abort the index build.
|
assert.commandWorked(primary.adminCommand({
|
- waitForFailPoint: "hangBeforeIndexBuildAbortOnInterrupt",
|
+ waitForFailPoint: "hangAfterIndexBuildAbortOnInterrupt",
|
timesEntered: hangBeforeAbortFailpointTimesEntered + 1,
|
maxTimeMS: kDefaultWaitForFailPointTimeout
|
}));
|
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
|
index 6c69b9ddc3..76cadea82d 100644
|
--- a/src/mongo/db/commands/create_indexes.cpp
|
+++ b/src/mongo/db/commands/create_indexes.cpp
|
@@ -78,6 +78,7 @@ MONGO_FAIL_POINT_DEFINE(createIndexesWriteConflict);
|
// collection is created.
|
MONGO_FAIL_POINT_DEFINE(hangBeforeCreateIndexesCollectionCreate);
|
MONGO_FAIL_POINT_DEFINE(hangBeforeIndexBuildAbortOnInterrupt);
|
+MONGO_FAIL_POINT_DEFINE(hangAfterIndexBuildAbortOnInterrupt);
|
|
constexpr auto kIndexesFieldName = "indexes"_sd;
|
constexpr auto kCommandName = "createIndexes"_sd;
|
@@ -1021,6 +1022,7 @@ public:
|
}
|
return runCreateIndexesWithCoordinator(opCtx, dbname, cmdObj, errmsg, result);
|
} catch (const DBException& ex) {
|
+ hangAfterIndexBuildAbortOnInterrupt.pauseWhileSet();
|
// We can only wait for an existing index build to finish if we are able to release
|
// our locks, in order to allow the existing index build to proceed. We cannot
|
// release locks in transactions, so we bypass the below logic in transactions.
|