From ac93489304b13a7349b303f3f0e5c57210037dbb Mon Sep 17 00:00:00 2001 From: Benety Goh Date: Thu, 14 May 2020 13:16:55 -0400 Subject: SERVER-48197 add fail point to indexbuildentryhelpers::getIndexBuildEntry() --- src/mongo/db/index_build_entry_helpers.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mongo/db/index_build_entry_helpers.cpp b/src/mongo/db/index_build_entry_helpers.cpp index b7a9c2acde8..5e1d42fbfa3 100644 --- a/src/mongo/db/index_build_entry_helpers.cpp +++ b/src/mongo/db/index_build_entry_helpers.cpp @@ -45,12 +45,15 @@ #include "mongo/db/record_id.h" #include "mongo/db/repl/local_oplog_info.h" #include "mongo/db/storage/write_unit_of_work.h" +#include "mongo/util/fail_point.h" #include "mongo/util/str.h" namespace mongo { namespace { +MONGO_FAIL_POINT_DEFINE(hangBeforeGettingIndexBuildEntry); + Status upsert(OperationContext* opCtx, const IndexBuildEntry& indexBuildEntry) { return writeConflictRetry(opCtx, @@ -260,6 +263,12 @@ StatusWith getIndexBuildEntry(OperationContext* opCtx, UUID ind ReadSourceScope readSourceScope(opCtx, RecoveryUnit::ReadSource::kNoTimestamp); AutoGetCollectionForRead autoCollection(opCtx, NamespaceString::kIndexBuildEntryNamespace); Collection* collection = autoCollection.getCollection(); + + // Must not be interruptible. This fail point is used to test the scenario where the index + // build's OperationContext is interrupted by an abort, which will subsequently remove index + // build entry from the config db collection. + hangBeforeGettingIndexBuildEntry.pauseWhileSet(/* Interruptible::notInterruptible() */); + if (!collection) { str::stream ss; ss << "Collection not found: " << NamespaceString::kIndexBuildEntryNamespace.ns(); -- cgit v1.2.1