summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2020-06-02 13:12:32 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-02 17:50:42 +0000
commitbaf75dd579bfec6554fa881b73cc427f0bbb3309 (patch)
tree2406e68b81a665f433e5e3025e60495ff53d763d /src
parent50b4d21e4a81d1c2b508772564e029641248f679 (diff)
downloadmongo-baf75dd579bfec6554fa881b73cc427f0bbb3309.tar.gz
SERVER-48062 Index build abort should not be interrupted by stepdown
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/index_builds_coordinator.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp
index fb1527d1158..2a4ecccb69a 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -71,6 +71,7 @@ MONGO_FAIL_POINT_DEFINE(hangAfterIndexBuildFirstDrain);
MONGO_FAIL_POINT_DEFINE(hangAfterIndexBuildSecondDrain);
MONGO_FAIL_POINT_DEFINE(hangAfterIndexBuildDumpsInsertsFromBulk);
MONGO_FAIL_POINT_DEFINE(hangAfterInitializingIndexBuild);
+MONGO_FAIL_POINT_DEFINE(hangBeforeCompletingAbort);
MONGO_FAIL_POINT_DEFINE(failIndexBuildOnCommit);
namespace {
@@ -1032,8 +1033,19 @@ bool IndexBuildsCoordinator::abortIndexBuildByBuildUUID(OperationContext* opCtx,
invariant(TryAbortResult::kContinueAbort == tryAbortResult);
+ if (MONGO_unlikely(hangBeforeCompletingAbort.shouldFail())) {
+ LOGV2(4806200, "Hanging before completing index build abort");
+ hangBeforeCompletingAbort.pauseWhileSet();
+ }
+
// At this point we must continue aborting the index build.
try {
+ // We are holding the RSTL and an exclusive collection lock, so we will block stepdown
+ // and be targeted for being killed. In addition to writing to the catalog, we need to
+ // acquire an IX lock to write to the config.system.indexBuilds collection. Since
+ // we must perform these final writes, but we expect them not to block, we can safely,
+ // temporarily disable interrupts.
+ UninterruptibleLockGuard noInterrupt(opCtx->lockState());
_completeAbort(opCtx, replState, signalAction, {ErrorCodes::IndexBuildAborted, reason});
} catch (const DBException& e) {
LOGV2_FATAL(