summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_consistency_markers.h
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2020-03-27 14:50:35 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 19:19:44 +0000
commitb70908c4898c4b02d8c70df3f796fa3e8cfe5bdd (patch)
treed29354ae8cf4931f7956de2eabd5bd56219027fc /src/mongo/db/repl/replication_consistency_markers.h
parentdc7724efa185a1b64f95fc84d0f7794dbc2fcdae (diff)
downloadmongo-b70908c4898c4b02d8c70df3f796fa3e8cfe5bdd.tar.gz
SERVER-46085 Fail initial sync attempt if sync source is in initial sync
Diffstat (limited to 'src/mongo/db/repl/replication_consistency_markers.h')
-rw-r--r--src/mongo/db/repl/replication_consistency_markers.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mongo/db/repl/replication_consistency_markers.h b/src/mongo/db/repl/replication_consistency_markers.h
index e873d4977c9..57cd96262c1 100644
--- a/src/mongo/db/repl/replication_consistency_markers.h
+++ b/src/mongo/db/repl/replication_consistency_markers.h
@@ -72,6 +72,16 @@ class StorageInterface;
* }
*
* See below for explanations of each field.
+ *
+ * The initialSyncId document, in 'local.replset.initialSyncId', is used to detect when nodes have
+ * been resynced. It is set at the end of initial sync, or whenever replication is started when the
+ * document does not exist.
+ *
+ * Example of all fields:
+ * {
+ * _id: <UUID>,
+ * wallTime: <Date_t>
+ * }
*/
class ReplicationConsistencyMarkers {
ReplicationConsistencyMarkers(const ReplicationConsistencyMarkers&) = delete;
@@ -254,6 +264,22 @@ public:
* or `oplogTruncateAfterPoint`.
*/
virtual Status createInternalCollections(OperationContext* opCtx) = 0;
+
+ /**
+ * Set the initial sync ID and wall time if it is not already set. This will create the
+ * collection if necessary.
+ */
+ virtual void setInitialSyncIdIfNotSet(OperationContext* opCtx) = 0;
+
+ /**
+ * Clears the initial sync ID by dropping the collection.
+ */
+ virtual void clearInitialSyncId(OperationContext* opCtx) = 0;
+
+ /**
+ * Returns the initial sync id object, or an empty object if none.
+ */
+ virtual BSONObj getInitialSyncId(OperationContext* opCtx) = 0;
};
} // namespace repl