From 1909cd159e4b0b3678513c8e3f83286051148b99 Mon Sep 17 00:00:00 2001 From: Xuerui Fa Date: Fri, 13 Mar 2020 16:31:02 -0400 Subject: SERVER-46195: Hang secondary before validate command in rollback_after_enabling_majority_reads.js --- src/mongo/db/repl/sync_tail.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 7a9e4b46d57..38c8b07256c 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -98,6 +98,7 @@ namespace { MONGO_FAIL_POINT_DEFINE(pauseBatchApplicationBeforeCompletion); MONGO_FAIL_POINT_DEFINE(hangAfterRecordingOpApplicationStartTime); +MONGO_FAIL_POINT_DEFINE(hangAfterTransitionToSecondary); /** * This variable determines the number of writer threads SyncTail will have. It can be overridden @@ -1012,6 +1013,13 @@ void SyncTail::_oplogApplication(OplogBuffer* oplogBuffer, // Transition to SECONDARY state, if possible. tryToGoLiveAsASecondary(&opCtx, replCoord, minValid); + if (MONGO_unlikely(hangAfterTransitionToSecondary.shouldFail()) && + replCoord->getMemberState().secondary()) { + log() << "fail point hangAfterTransitionToSecondary enabled. Blocking until fail point " + "is disabled."; + MONGO_FAIL_POINT_PAUSE_WHILE_SET(hangAfterTransitionToSecondary); + } + // Blocks up to a second waiting for a batch to be ready to apply. If one doesn't become // ready in time, we'll loop again so we can do the above checks periodically. OpQueue ops = batcher->getNextBatch(Seconds(1)); -- cgit v1.2.1