diff options
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_test_fixture.cpp')
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_test_fixture.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp index aaa00fcdae4..e5a17dd5c1a 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp @@ -323,10 +323,6 @@ void ReplCoordTest::simulateSuccessfulV1ElectionAt(Date_t electionTime) { ReplSetHeartbeatResponse hbResp; hbResp.setSetName(rsConfig.getReplSetName()); hbResp.setState(MemberState::RS_SECONDARY); - // The smallest valid optime in PV1. - OpTime opTime(Timestamp(), 0); - hbResp.setAppliedOpTime(opTime); - hbResp.setDurableOpTime(opTime); hbResp.setConfigVersion(rsConfig.getConfigVersion()); net->scheduleResponse(noi, net->now(), makeResponseStatus(hbResp.toBSON(true))); } else if (request.cmdObj.firstElement().fieldNameStringData() == "replSetRequestVotes") { @@ -492,30 +488,32 @@ void ReplCoordTest::disableSnapshots() { _externalState->setAreSnapshotsEnabled(false); } -void ReplCoordTest::simulateCatchUpAbort() { +void ReplCoordTest::simulateCatchUpTimeout() { NetworkInterfaceMock* net = getNet(); - auto heartbeatTimeoutWhen = - net->now() + getReplCoord()->getConfig().getHeartbeatTimeoutPeriodMillis(); + auto catchUpTimeoutWhen = net->now() + getReplCoord()->getConfig().getCatchUpTimeoutPeriod(); bool hasRequest = false; net->enterNetwork(); - if (net->now() < heartbeatTimeoutWhen) { - net->runUntil(heartbeatTimeoutWhen); + if (net->now() < catchUpTimeoutWhen) { + net->runUntil(catchUpTimeoutWhen); } hasRequest = net->hasReadyRequests(); + net->exitNetwork(); + while (hasRequest) { + net->enterNetwork(); auto noi = net->getNextReadyRequest(); auto request = noi->getRequest(); // Black hole heartbeat requests caused by time advance. log() << "Black holing request to " << request.target.toString() << " : " << request.cmdObj; net->blackHole(noi); - if (net->now() < heartbeatTimeoutWhen) { - net->runUntil(heartbeatTimeoutWhen); + if (net->now() < catchUpTimeoutWhen) { + net->runUntil(catchUpTimeoutWhen); } else { net->runReadyNetworkOperations(); } hasRequest = net->hasReadyRequests(); + net->exitNetwork(); } - net->exitNetwork(); } } // namespace repl |