diff options
author | Benety Goh <benety@mongodb.com> | 2020-05-14 13:16:55 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-14 20:37:40 +0000 |
commit | 3e8707333f3a618241e474e8444e87eed0c9aa29 (patch) | |
tree | 3f2180130354e11e57c02be22d0aa44d3b9346ba /src | |
parent | af0b2b1ceaa2e1e291e9ae7d9005892722846bd2 (diff) | |
download | mongo-3e8707333f3a618241e474e8444e87eed0c9aa29.tar.gz |
SERVER-48197 add fail point to indexbuildentryhelpers::getIndexBuildEntry()
(cherry picked from commit ac93489304b13a7349b303f3f0e5c57210037dbb)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/index_build_entry_helpers.cpp | 9 |
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(); |