summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorXuerui Fa <xuerui.fa@mongodb.com>2020-03-13 16:31:02 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-17 18:45:56 +0000
commit1909cd159e4b0b3678513c8e3f83286051148b99 (patch)
tree8e6dd733dd61787028083b10d7fc7da2ebfc16cc /src/mongo/db/repl
parentab8166fcd2855cc71e895101f5d7e6450b9ae8ed (diff)
downloadmongo-1909cd159e4b0b3678513c8e3f83286051148b99.tar.gz
SERVER-46195: Hang secondary before validate command in rollback_after_enabling_majority_reads.js
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/sync_tail.cpp8
1 files changed, 8 insertions, 0 deletions
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));