0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-49006 Move initial sync oldest_timestamp advancement directly into initial sync oplog application callback

This commit is contained in:
William Schultz 2020-06-24 21:36:02 -04:00 committed by Evergreen Agent
parent 34e947185b
commit 6225672cf9

View File

@ -299,6 +299,11 @@ InitialSyncerOptions createInitialSyncerOptions(
ReplicationCoordinator::DataConsistency consistency) {
// Note that setting the last applied opTime forward also advances the global timestamp.
replCoord->setMyLastAppliedOpTimeAndWallTimeForward(opTimeAndWallTime, consistency);
// The oplog application phase of initial sync starts timestamping writes, causing
// WiredTiger to pin this data in memory. Advancing the oldest timestamp in step with the
// last applied optime here will permit WiredTiger to evict this data as it sees fit.
replCoord->getServiceContext()->getStorageEngine()->setOldestTimestamp(
opTimeAndWallTime.opTime.getTimestamp());
};
options.resetOptimes = [replCoord]() { replCoord->resetMyLastOpTimes(); };
options.syncSourceSelector = replCoord;
@ -1440,11 +1445,6 @@ void ReplicationCoordinatorImpl::_setMyLastAppliedOpTimeAndWallTime(
!serverGlobalParams.enableMajorityReadConcern) {
_setStableTimestampForStorage(lk);
}
} else if (_getMemberState_inlock().startup2()) {
// The oplog application phase of initial sync starts timestamping writes, causing
// WiredTiger to pin this data in memory. Advancing the oldest timestamp in step with the
// last applied optime here will permit WiredTiger to evict this data as it sees fit.
_service->getStorageEngine()->setOldestTimestamp(opTime.getTimestamp());
}
}