summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Chan <jason.chan@mongodb.com>2019-10-09 15:25:52 +0000
committerevergreen <evergreen@mongodb.com>2019-10-09 15:25:52 +0000
commit2b9354fd6fddc70aecfcaf3dc53593df203248b8 (patch)
treef0f67b66c255744032750b39b4fa6047d8585b17
parent8ac53a6a615f14c78cf007ae6a58688849b63f56 (diff)
downloadmongo-2b9354fd6fddc70aecfcaf3dc53593df203248b8.tar.gz
SERVER-34557 last_vote.js needs to wait for stable node before reading oplog
(cherry picked from commit 381acc4baa6d5f730fb77be5acc39f8473a16b88) SERVER-34557 Make sure slave_delay_clean_shutdown.js awaits secondary nodes before reading from oplog after restarting node (cherry picked from commit 978ee4b254f75351006648577f1e0fd3673ee412)
-rw-r--r--jstests/replsets/last_vote.js2
-rw-r--r--jstests/replsets/slave_delay_clean_shutdown.js2
2 files changed, 4 insertions, 0 deletions
diff --git a/jstests/replsets/last_vote.js b/jstests/replsets/last_vote.js
index 44d349f3237..12f13493f08 100644
--- a/jstests/replsets/last_vote.js
+++ b/jstests/replsets/last_vote.js
@@ -113,6 +113,8 @@
jsTestLog("Restarting node 0 in replica set mode");
node0 = rst.restart(0); // Restart in replSet mode again.
+ rst.waitForState(node0, ReplSetTest.State.SECONDARY);
+
assert.soonNoExcept(function() {
assertCurrentTerm(node0, term);
return true;
diff --git a/jstests/replsets/slave_delay_clean_shutdown.js b/jstests/replsets/slave_delay_clean_shutdown.js
index fe5b9e62164..80371048b6b 100644
--- a/jstests/replsets/slave_delay_clean_shutdown.js
+++ b/jstests/replsets/slave_delay_clean_shutdown.js
@@ -56,6 +56,8 @@ load('jstests/replsets/rslib.js');
assert.lt(Date.timeFunc(() => rst.stop(1)), 60 * 1000);
secondary = rst.restart(1);
+ rst.awaitSecondaryNodes();
+
assert.eq(getLatestOp(secondary), lastOp);
sleep(2000); // Prevent the test from passing by chance.
assert.eq(getLatestOp(secondary), lastOp);