diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2020-07-23 10:03:23 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-23 14:29:55 +0000 |
commit | bae276d5c8f255f34bdf1eeb045133b170bf735c (patch) | |
tree | 70be4ad56723cfed3143d21de6ca5ee80bc4876e /src/mongo/db/index | |
parent | 15d23a48c8a8767ce3c5fc5165d5888608a454b4 (diff) | |
download | mongo-bae276d5c8f255f34bdf1eeb045133b170bf735c.tar.gz |
SERVER-48418 Test rollback with resumable index builds
Diffstat (limited to 'src/mongo/db/index')
-rw-r--r-- | src/mongo/db/index/index_build_interceptor.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/mongo/db/index/index_build_interceptor.cpp b/src/mongo/db/index/index_build_interceptor.cpp index da82e906e8d..1ab952d3640 100644 --- a/src/mongo/db/index/index_build_interceptor.cpp +++ b/src/mongo/db/index/index_build_interceptor.cpp @@ -51,9 +51,25 @@ #include "mongo/util/uuid.h" namespace mongo { +namespace { + +void checkDrainPhaseFailPoint(FailPoint* fp, long long iteration) { + fp->executeIf( + [=](const BSONObj& data) { + LOGV2(4841800, + "Hanging index build during drain writes phase", + "iteration"_attr = iteration); + + fp->pauseWhileSet(); + }, + [iteration](const BSONObj& data) { return iteration == data["iteration"].numberLong(); }); +} + +} // namespace MONGO_FAIL_POINT_DEFINE(hangDuringIndexBuildDrainYield); MONGO_FAIL_POINT_DEFINE(hangIndexBuildDuringDrainWritesPhase); +MONGO_FAIL_POINT_DEFINE(hangIndexBuildDuringDrainWritesPhaseSecond); bool IndexBuildInterceptor::typeCanFastpathMultikeyUpdates(IndexType indexType) { // Ensure no new indexes are added without considering whether they use the multikeyPaths @@ -187,18 +203,9 @@ Status IndexBuildInterceptor::drainWritesIntoIndex(OperationContext* opCtx, break; } - hangIndexBuildDuringDrainWritesPhase.executeIf( - [&](const BSONObj& data) { - LOGV2(4924401, - "Hanging index build during drain writes phase due to " - "'hangIndexBuildDuringDrainWritesPhase' failpoint", - "iteration"_attr = _numApplied + batchSize); - - hangIndexBuildDuringDrainWritesPhase.pauseWhileSet(); - }, - [&](const BSONObj& data) { - return _numApplied + batchSize == data["iteration"].numberLong(); - }); + const long long iteration = _numApplied + batchSize; + checkDrainPhaseFailPoint(&hangIndexBuildDuringDrainWritesPhase, iteration); + checkDrainPhaseFailPoint(&hangIndexBuildDuringDrainWritesPhaseSecond, iteration); batchSize += 1; batchSizeBytes += objSize; |