summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuayu Ouyang <huayu.ouyang@mongodb.com>2021-12-03 19:37:00 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-17 19:22:54 +0000
commitf5261387f8a94c4005b154c640c8f6c44c84937d (patch)
tree2426eca8fcc7c400ce3c99fb5b802a59c384d7c9
parent95a2b587959cf380b64f25c7ea44343140ac44d9 (diff)
downloadmongo-f5261387f8a94c4005b154c640c8f6c44c84937d.tar.gz
SERVER-61858 Wait for node to become primary before disconnecting in sync_source_selection_ignores_minvalid_after_rollback.js
(cherry picked from commit d0a90be51cf5d1cc2feeb0a0ddbd6ed4802f8fd7)
-rw-r--r--jstests/replsets/sync_source_selection_ignores_minvalid_after_rollback.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/jstests/replsets/sync_source_selection_ignores_minvalid_after_rollback.js b/jstests/replsets/sync_source_selection_ignores_minvalid_after_rollback.js
index 2b7d341cb1e..ee7c23b0db0 100644
--- a/jstests/replsets/sync_source_selection_ignores_minvalid_after_rollback.js
+++ b/jstests/replsets/sync_source_selection_ignores_minvalid_after_rollback.js
@@ -75,6 +75,12 @@ const electionShell = startParallelShell(() => {
jsTestLog("Waiting for node 1 to vote in election");
checkLog.containsJson(node1, 5972100);
+jsTestLog("Waiting for node 2 to be writable primary");
+
+// Wait for parallelShell to exit. This means that node 2 has successfully transitioned to primary.
+electionShell();
+assert.eq(rst.getPrimary(), node2);
+
jsTestLog("Waiting for node 1 to replicate diverging branch");
// Disconnect node 1 from node 2 so that node 1 won't switch sync sources from node 0 to node 2.
// It's okay if node 1 doesn't have a sync source since it should have already received the batch
@@ -84,12 +90,6 @@ node1StopRepl.off();
awaitOpTime(node1, node0);
node1.reconnect(node2);
-jsTestLog("Waiting for node 2 to be writable primary");
-
-// Wait for parallelShell to exit. This means that node 2 has successfully transitioned to primary.
-electionShell();
-assert.eq(rst.getPrimary(), node2);
-
jsTestLog("Waiting for node 0 to step down");
rst.awaitSecondaryNodes(null, [node0]);