summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/index_build_entry_helpers.cpp9
1 files changed, 9 insertions, 0 deletions
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<IndexBuildEntry> 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();