summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/multi_index_block.cpp
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2020-11-03 09:42:53 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-03 15:00:25 +0000
commit1e882de84f789906b0dd193c9af7f1731605d10e (patch)
tree53cb3e4d18bf37f7cb6ce135c6d2dd44f9394eac /src/mongo/db/catalog/multi_index_block.cpp
parentb2c459bd3e5842ffe3ca4959e04e5912791a83c3 (diff)
downloadmongo-1e882de84f789906b0dd193c9af7f1731605d10e.tar.gz
SERVER-51136 Test resuming multiple index builds for rollback
Diffstat (limited to 'src/mongo/db/catalog/multi_index_block.cpp')
-rw-r--r--src/mongo/db/catalog/multi_index_block.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp
index 37025a4656a..d02bc489eaa 100644
--- a/src/mongo/db/catalog/multi_index_block.cpp
+++ b/src/mongo/db/catalog/multi_index_block.cpp
@@ -388,11 +388,25 @@ Status MultiIndexBlock::insertAllDocumentsInCollection(
progress.set(CurOp::get(opCtx)->setProgress_inlock(curopMessage, numRecords));
}
- if (MONGO_unlikely(hangAfterSettingUpIndexBuild.shouldFail())) {
- // Hang the build after the curOP info is set up.
- LOGV2(20387, "Hanging index build due to failpoint 'hangAfterSettingUpIndexBuild'");
- hangAfterSettingUpIndexBuild.pauseWhileSet();
- }
+ hangAfterSettingUpIndexBuild.executeIf(
+ [buildUUID = _buildUUID](const BSONObj& data) {
+ // Hang the build after the curOP info is set up.
+ LOGV2(20387,
+ "Hanging index build due to failpoint 'hangAfterSettingUpIndexBuild'",
+ "buildUUID"_attr = buildUUID);
+ hangAfterSettingUpIndexBuild.pauseWhileSet();
+ },
+ [buildUUID = _buildUUID](const BSONObj& data) {
+ if (!buildUUID || !data.hasField("buildUUIDs")) {
+ return true;
+ }
+
+ auto buildUUIDs = data.getObjectField("buildUUIDs");
+ return std::any_of(
+ buildUUIDs.begin(), buildUUIDs.end(), [buildUUID = *buildUUID](const auto& elem) {
+ return UUID::parse(elem.String()) == buildUUID;
+ });
+ });
if (MONGO_unlikely(hangAfterSettingUpIndexBuildUnlocked.shouldFail())) {
uassert(4585200, "failpoint may not be set on foreground indexes", isBackgroundBuilding());
@@ -957,6 +971,7 @@ Status MultiIndexBlock::_failPointHangDuringBuild(OperationContext* opCtx,
"Hanging index build during collection scan phase",
"where"_attr = where,
"doc"_attr = doc,
+ "iteration"_attr = iteration,
"buildUUID"_attr = _buildUUID);
fp->pauseWhileSet(opCtx);