diff options
author | Samy Lanka <samy.lanka@mongodb.com> | 2019-01-24 21:57:25 -0500 |
---|---|---|
committer | Samy Lanka <samy.lanka@mongodb.com> | 2019-02-11 12:27:33 -0500 |
commit | 4f858c52b05ecc49d2ae19bbaf59fc0aad445b7e (patch) | |
tree | 2af6afbcb4d27b4b1ce22eb25750583666396a8a /src/mongo/db/repl/oplog_fetcher.cpp | |
parent | d568e329a67eee8ba241d52067750a3d8c42dc0f (diff) | |
download | mongo-4f858c52b05ecc49d2ae19bbaf59fc0aad445b7e.tar.gz |
SERVER-36489 Start initial sync oplog fetching from the 'oldest active transaction timestamp'
SERVER-36490 Initial sync should not actually prepare transactions on applying prepareTransaction oplog entries
SERVER-36491 During initial sync, make commitTransaction oplog entries apply the transaction from the prepare oplog entry
Diffstat (limited to 'src/mongo/db/repl/oplog_fetcher.cpp')
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp index 7850334f478..0b71deac9d2 100644 --- a/src/mongo/db/repl/oplog_fetcher.cpp +++ b/src/mongo/db/repl/oplog_fetcher.cpp @@ -323,7 +323,8 @@ OplogFetcher::OplogFetcher(executor::TaskExecutor* executor, DataReplicatorExternalState* dataReplicatorExternalState, EnqueueDocumentsFn enqueueDocumentsFn, OnShutdownCallbackFn onShutdownCallbackFn, - const int batchSize) + const int batchSize, + StartingPoint startingPoint) : AbstractOplogFetcher(executor, lastFetched, source, @@ -337,7 +338,8 @@ OplogFetcher::OplogFetcher(executor::TaskExecutor* executor, _dataReplicatorExternalState(dataReplicatorExternalState), _enqueueDocumentsFn(enqueueDocumentsFn), _awaitDataTimeout(calculateAwaitDataTimeout(config)), - _batchSize(batchSize) { + _batchSize(batchSize), + _startingPoint(startingPoint) { invariant(config.isInitialized()); invariant(enqueueDocumentsFn); @@ -444,8 +446,11 @@ StatusWith<BSONObj> OplogFetcher::_onSuccessfulBatch(const Fetcher::QueryRespons LOG(1) << "oplog fetcher successfully fetched from " << _getSource(); - // If this is the first batch and no rollback is needed, skip the first document. - firstDocToApply++; + // If this is the first batch, no rollback is needed and we don't want to enqueue the first + // document, skip it. + if (_startingPoint == StartingPoint::kSkipFirstDoc) { + firstDocToApply++; + } } auto validateResult = |