summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingzhi Deng <lingzhi.deng@mongodb.com>2019-10-17 19:53:40 +0000
committerevergreen <evergreen@mongodb.com>2019-10-17 19:53:40 +0000
commitda0131a512503577cb942ac51924c73eed09fa46 (patch)
tree57a5f0443b9ecea071e18c2987940c4a0bc4e4d3
parentea9d7106c6fd91b1b62777940b4d3b5183204d4a (diff)
downloadmongo-da0131a512503577cb942ac51924c73eed09fa46.tar.gz
SERVER-43729: Wait for secondary state before running replSetFreeze in RollbackTest.transitionToSyncSourceOperationsDuringRollback
(cherry picked from commit 22c6eb00028fae04472a08b7029cf664d2243c71)
-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 8c5002f63c7..359a26fcc9b 100644
--- a/jstests/replsets/libs/rollback_test.js
+++ b/jstests/replsets/libs/rollback_test.js
@@ -365,6 +365,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