diff options
author | Samyukta Lanka <samy.lanka@mongodb.com> | 2019-09-25 20:05:10 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-25 20:05:10 +0000 |
commit | 9685608f8479f8c9c39f7dbfd1f71f5d4d3b7012 (patch) | |
tree | 8ac1677bbc8150fa3bd0e4448c8e3cb20a2d14d4 | |
parent | 56cd56baabef1cc06315a6269d8e58c5f35f144e (diff) | |
download | mongo-9685608f8479f8c9c39f7dbfd1f71f5d4d3b7012.tar.gz |
SERVER-43230 Fix race in catchup_takeover_two_nodes_ahead.js
(cherry picked from commit 0efd66f7a4f208176acbcf8fb209dcc10bba6f84)
-rw-r--r-- | jstests/replsets/catchup_takeover_two_nodes_ahead.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/jstests/replsets/catchup_takeover_two_nodes_ahead.js b/jstests/replsets/catchup_takeover_two_nodes_ahead.js index 31b78302329..4cdefc8fcdc 100644 --- a/jstests/replsets/catchup_takeover_two_nodes_ahead.js +++ b/jstests/replsets/catchup_takeover_two_nodes_ahead.js @@ -56,8 +56,7 @@ jsTestLog('node 2 is now primary, but cannot accept writes'); assert.commandFailedWithCode(nodes[2].getDB(name).bar.insert({z: 100}, writeConcern), ErrorCodes.NotMaster); -// Confirm that the most up-to-date node becomes primary -// after the default catchup delay. +// Confirm that the most up-to-date node becomes primary after the default catchup delay. replSet.waitForState(0, ReplSetTest.State.PRIMARY, 60 * 1000); // Check that both the 'called' and 'successful' fields of the 'catchUpTakeover' election reason @@ -66,6 +65,9 @@ const newPrimaryStatus = assert.commandWorked(primary.adminCommand({serverStatus verifyServerStatusElectionReasonCounterChange( initialPrimaryStatus.electionMetrics, newPrimaryStatus.electionMetrics, "catchUpTakeover", 1); +// Wait until the old primary steps down. +replSet.waitForState(2, ReplSetTest.State.SECONDARY, replSet.kDefaultTimeoutMS); + // Check that the 'numCatchUpsFailedWithNewTerm' field has been incremented in serverStatus, and // that none of the other reasons for catchup concluding has been incremented. const newNode2Status = assert.commandWorked(nodes[2].adminCommand({serverStatus: 1})); @@ -73,8 +75,6 @@ verifyCatchUpConclusionReason(initialNode2Status.electionMetrics, newNode2Status.electionMetrics, 'numCatchUpsFailedWithNewTerm'); -// Wait until the old primary steps down so the connections won't be closed. -replSet.waitForState(2, ReplSetTest.State.SECONDARY, replSet.kDefaultTimeoutMS); // Let the nodes catchup. restartServerReplication(nodes.slice(1, 5)); replSet.stopSet(); |