summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog_fetcher.h
diff options
context:
space:
mode:
authorXuerui Fa <xuerui.fa@mongodb.com>2020-05-18 15:20:41 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-21 18:46:44 +0000
commit7812887269d1623159c541f01b61e99f359cec0b (patch)
tree14ef89a45a1eb158d12df5646da224b2c1ec1825 /src/mongo/db/repl/oplog_fetcher.h
parentef8b64b9e2f46955942240e57292d25740e11807 (diff)
downloadmongo-7812887269d1623159c541f01b61e99f359cec0b.tar.gz
SERVER-28068: Prevent nodes from going into rollback due to falling off the sync source's oplog
Diffstat (limited to 'src/mongo/db/repl/oplog_fetcher.h')
-rw-r--r--src/mongo/db/repl/oplog_fetcher.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h
index 7d66b38c109..0292dc5e7b0 100644
--- a/src/mongo/db/repl/oplog_fetcher.h
+++ b/src/mongo/db/repl/oplog_fetcher.h
@@ -346,6 +346,28 @@ private:
*/
Milliseconds _getRetriedFindMaxTime() const;
+ /**
+ * Checks the first batch of results from query.
+ * 'documents' are the first batch of results returned from tailing the remote oplog.
+ * 'remoteLastOpApplied' is the last OpTime applied on the sync source.
+ * 'remoteRBID' is a RollbackId for the sync source returned in this oplog query. This is
+ * optional for compatibility with 3.4 servers that do not send OplogQueryMetadata.
+ *
+ * Returns TooStaleToSyncFromSource if we are too stale to sync from our source.
+ * Returns OplogStartMissing if we should go into rollback.
+ */
+ Status _checkRemoteOplogStart(const OplogFetcher::Documents& documents,
+ OpTime remoteLastOpApplied,
+ int remoteRBID);
+
+ /**
+ * Distinguishes between needing to rollback and being too stale to sync from our sync source.
+ * This will be called when we check the first batch of results and our last fetched optime does
+ * not equal the first document in that batch. This function should never return Status::OK().
+ */
+ Status _checkTooStaleToSyncFromSource(const OpTime lastFetched,
+ const OpTime firstOpTimeInDocument);
+
// Protects member data of this OplogFetcher.
mutable Mutex _mutex = MONGO_MAKE_LATCH("OplogFetcher::_mutex");