From da0131a512503577cb942ac51924c73eed09fa46 Mon Sep 17 00:00:00 2001 From: Lingzhi Deng Date: Thu, 17 Oct 2019 19:53:40 +0000 Subject: SERVER-43729: Wait for secondary state before running replSetFreeze in RollbackTest.transitionToSyncSourceOperationsDuringRollback (cherry picked from commit 22c6eb00028fae04472a08b7029cf664d2243c71) --- jstests/replsets/libs/rollback_test.js | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.1