diff options
author | Vesselina Ratcheva <vesselina.ratcheva@mongodb.com> | 2018-09-06 15:24:36 -0400 |
---|---|---|
committer | Vesselina Ratcheva <vesselina.ratcheva@10gen.com> | 2018-09-13 19:29:12 -0400 |
commit | 58e6224a7b2ff55f111e1b2fd69218ad43e91cd7 (patch) | |
tree | 67a4931a7bcac3478c4e7f316dcbfc81a37987e8 | |
parent | b7c2a87a3d0c0395be5ab366dcff49c23ae88a57 (diff) | |
download | mongo-58e6224a7b2ff55f111e1b2fd69218ad43e91cd7.tar.gz |
SERVER-36732 Wait for secondaries to be up and electable in election handoff jstests
-rw-r--r-- | jstests/replsets/libs/election_handoff.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/replsets/libs/election_handoff.js b/jstests/replsets/libs/election_handoff.js index 47166b325cb..671a237cd9b 100644 --- a/jstests/replsets/libs/election_handoff.js +++ b/jstests/replsets/libs/election_handoff.js @@ -42,6 +42,13 @@ var ElectionHandoffTest = (function() { jsTestLog("Stepping down primary..."); + // Make sure all secondaries are ready before stepping down. We must additionally + // make sure that the primary is aware that the secondaries are ready and caught up + // to the primary's lastApplied, so we issue a dummy write and wait on its optime. + assert.writeOK(primary.getDB("test").secondariesMustBeCaughtUpToHere.insert( + {"a": 1}, {w: rst.nodes.length})); + rst.awaitNodesAgreeOnAppliedOpTime(); + // Step down the current primary. assert.adminCommandWorkedAllowingNetworkError(primary, { replSetStepDown: kStepDownPeriodSecs, |