summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog_fetcher.cpp
diff options
context:
space:
mode:
authorSamy Lanka <samy.lanka@mongodb.com>2019-04-30 21:59:26 -0400
committerSamy Lanka <samy.lanka@mongodb.com>2019-05-06 17:23:18 -0400
commit8ad1effc48ac5193c5f57630d1fbce8bda0cfdaf (patch)
treef12beec2e31fc5a189bbf1943682f2b05a77972d /src/mongo/db/repl/oplog_fetcher.cpp
parenta25226e009fa1598f3077dd7972b9be3d2368785 (diff)
downloadmongo-8ad1effc48ac5193c5f57630d1fbce8bda0cfdaf.tar.gz
SERVER-36492 Reconstruct prepared transactions at the end of initial sync
Diffstat (limited to 'src/mongo/db/repl/oplog_fetcher.cpp')
-rw-r--r--src/mongo/db/repl/oplog_fetcher.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp
index a432da62bb4..2a98c73b262 100644
--- a/src/mongo/db/repl/oplog_fetcher.cpp
+++ b/src/mongo/db/repl/oplog_fetcher.cpp
@@ -252,7 +252,10 @@ StatusWith<boost::optional<rpc::OplogQueryMetadata>> parseOplogQueryMetadata(
} // namespace
StatusWith<OplogFetcher::DocumentsInfo> OplogFetcher::validateDocuments(
- const Fetcher::Documents& documents, bool first, Timestamp lastTS) {
+ const Fetcher::Documents& documents,
+ bool first,
+ Timestamp lastTS,
+ StartingPoint startingPoint) {
if (first && documents.empty()) {
return Status(ErrorCodes::OplogStartMissing,
str::stream() << "The first batch of oplog entries is empty, but expected at "
@@ -300,7 +303,7 @@ StatusWith<OplogFetcher::DocumentsInfo> OplogFetcher::validateDocuments(
// These numbers are for the documents we will apply.
info.toApplyDocumentCount = documents.size();
info.toApplyDocumentBytes = info.networkDocumentBytes;
- if (first) {
+ if (first && startingPoint == StartingPoint::kSkipFirstDoc) {
// The count is one less since the first document found was already applied ($gte $ts query)
// and we will not apply it again.
--info.toApplyDocumentCount;
@@ -466,8 +469,8 @@ StatusWith<BSONObj> OplogFetcher::_onSuccessfulBatch(const Fetcher::QueryRespons
}
}
- auto validateResult =
- OplogFetcher::validateDocuments(documents, queryResponse.first, lastFetched.getTimestamp());
+ auto validateResult = OplogFetcher::validateDocuments(
+ documents, queryResponse.first, lastFetched.getTimestamp(), _startingPoint);
if (!validateResult.isOK()) {
return validateResult.getStatus();
}