diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2017-04-25 16:38:19 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2017-04-27 14:15:09 -0400 |
commit | 6626128371d5f56cfae1079d0d67ec675f06bb84 (patch) | |
tree | 73f610c68acbba7d785445e3fec15c63550354c0 /jstests/replsets/catchup.js | |
parent | f684cc26a6ec6d0f6588fd3fc77d037c1296980c (diff) | |
download | mongo-6626128371d5f56cfae1079d0d67ec675f06bb84.tar.gz |
SERVER-28969 Wait until the voter has the latest optime in case 3 of catchup.js
Diffstat (limited to 'jstests/replsets/catchup.js')
-rw-r--r-- | jstests/replsets/catchup.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/jstests/replsets/catchup.js b/jstests/replsets/catchup.js index 51632379463..9e79e87708c 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. |