summaryrefslogtreecommitdiff
path: root/jstests/replsets/libs/rollback_test.js
diff options
context:
space:
mode:
authorLingzhi Deng <lingzhi.deng@mongodb.com>2019-10-10 18:01:40 +0000
committerevergreen <evergreen@mongodb.com>2019-10-10 18:01:40 +0000
commit22c6eb00028fae04472a08b7029cf664d2243c71 (patch)
tree4378d588c64f9e66f836351f10620cfd57fbb489 /jstests/replsets/libs/rollback_test.js
parent6fa4758e50857bb7dcb792d9740216663afce1bb (diff)
downloadmongo-22c6eb00028fae04472a08b7029cf664d2243c71.tar.gz
SERVER-43729: Wait for secondary state before running replSetFreeze in RollbackTest.transitionToSyncSourceOperationsDuringRollback
Diffstat (limited to 'jstests/replsets/libs/rollback_test.js')
-rw-r--r--jstests/replsets/libs/rollback_test.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/jstests/replsets/libs/rollback_test.js b/jstests/replsets/libs/rollback_test.js
index 2cf97d25a2d..e7e28e3502f 100644
--- a/jstests/replsets/libs/rollback_test.js
+++ b/jstests/replsets/libs/rollback_test.js
@@ -372,6 +372,12 @@ function RollbackTest(name = "RollbackTest", replSet) {
this.transitionToSyncSourceOperationsDuringRollback = function() {
transitionIfAllowed(State.kSyncSourceOpsDuringRollback);
+ // If the rollback node was restarted, make sure it has finished restarting and become a
+ // secondary again. Otherwise, the subsequent 'replSetFreeze' command could fail with
+ // NotYetInitialized if the node is still in the process of restarting (e.g. not yet loaded
+ // the local config or reached the STARTUP2 state).
+ waitForState(curSecondary, ReplSetTest.State.SECONDARY);
+
// If the nodes are restarted after the rollback node is able to rollback successfully and
// catch up to curPrimary's oplog, then the rollback node can become the new primary.
// If so, it can lead to unplanned state transitions, like unconditional step down, during