summaryrefslogtreecommitdiff
path: root/jstests
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-03 20:09:13 +0000
commitd0a90be51cf5d1cc2feeb0a0ddbd6ed4802f8fd7 (patch)
treea7c651f57b9edc537e4edfa5f2219635e07cfa1d /jstests
parent3242083daae059800badc55b6c4e050454fa6c70 (diff)
downloadmongo-d0a90be51cf5d1cc2feeb0a0ddbd6ed4802f8fd7.tar.gz
SERVER-61858 Wait for node to become primary before disconnecting in sync_source_selection_ignores_minvalid_after_rollback.js
Diffstat (limited to 'jstests')
-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]);