summaryrefslogtreecommitdiff
path: root/jstests/replsets/libs/rollback_test.js
diff options
context:
space:
mode:
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