summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2017-04-25 16:38:19 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2017-06-16 13:59:29 -0400
commit1b5e99525f78b0e88eac7dd8663d44d543195803 (patch)
tree00cc2c580a083ebbdf03ccae519f3000dbfa3efd
parent133978ed116d3852bb1b8557cc8603b7f6045947 (diff)
downloadmongo-1b5e99525f78b0e88eac7dd8663d44d543195803.tar.gz
SERVER-28969 Wait until the voter has the latest optime in case 3 of catchup.js
(cherry picked from commit 6626128371d5f56cfae1079d0d67ec675f06bb84)
-rw-r--r--jstests/replsets/catchup.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/jstests/replsets/catchup.js b/jstests/replsets/catchup.js
index 797db8305cd..93826d65c8a 100644
--- a/jstests/replsets/catchup.js
+++ b/jstests/replsets/catchup.js
@@ -123,7 +123,14 @@
restartServerReplication(stepUpResults.voter);
assert.commandWorked(
stepUpResults.voter.adminCommand({replSetSyncFrom: stepUpResults.oldPrimary.host}));
- awaitOpTime(stepUpResults.voter, stepUpResults.latestOpOnOldPrimary.ts);
+ // Wait until the new primary knows the last applied optime on the voter, so it will keep
+ // catching up after the old primary is disconnected.
+ assert.soon(function() {
+ var replSetStatus =
+ assert.commandWorked(stepUpResults.newPrimary.adminCommand({replSetGetStatus: 1}));
+ var voterStatus = replSetStatus.members.filter(m => m.name == stepUpResults.voter.host)[0];
+ return rs.compareOpTimes(voterStatus.optime, stepUpResults.latestOpOnOldPrimary) == 0;
+ });
// Disconnect the new primary and the old one.
stepUpResults.oldPrimary.disconnect(stepUpResults.newPrimary);
// Disable the failpoint, the new primary should sync from the other secondary.