diff options
author | Vesselina Ratcheva <vesselina.ratcheva@10gen.com> | 2020-06-11 01:47:56 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-15 23:44:50 +0000 |
commit | 6869bdc727c77beb63821b67383cc095bd7c83fc (patch) | |
tree | 674836e75d97189f73e7e7d58a437a1c369378f5 | |
parent | 80f424c02df47469792917673ab7e6dd77b01421 (diff) | |
download | mongo-6869bdc727c77beb63821b67383cc095bd7c83fc.tar.gz |
SERVER-46730 Update repl arch guide for initial sync semantics
-rw-r--r-- | src/mongo/db/repl/README.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/db/repl/README.md b/src/mongo/db/repl/README.md index 57d84b81a3f..21e4dac8d7e 100644 --- a/src/mongo/db/repl/README.md +++ b/src/mongo/db/repl/README.md @@ -1519,6 +1519,26 @@ flag and tell the storage engine that the [`initialDataTimestamp`](#replication- is the node's last applied OpTime. Finally, the `InitialSyncer` shuts down and the `ReplicationCoordinator` starts steady state replication. +## Initial Sync Semantics + +Nodes in initial sync do not contribute to write concern acknowledgment. While in a `STARTUP2` +state, a node will not send any `replSetUpdatePosition` commands to its sync source. It will also +have the `lastAppliedOpTime` and `lastDurableOpTime` set to null in heartbeat responses. The +combined effect of this is that the primary of the replica set will not receive updates about the +initial syncing node's progress, and will thus not be able to count that member towards the +acknowledgment of writes. + +In a similar vein, we prevent new members from voting (or increasing the number of nodes needed +to commit majority writes) until they have successfully completed initial sync and transitioned +to `SECONDARY` state. This is done as follows: whenever a new voting node is added to the set, we +internally rewrite its `MemberConfig` to have a special [`newlyAdded=true`](https://github.com/mongodb/mongo/blob/80f424c02df47469792917673ab7e6dd77b01421/src/mongo/db/repl/member_config.idl#L75-L81) +field. This field signifies that this node is temporarily non-voting and should thus be excluded +from all voter checks or counts. Once the replica set primary receives a heartbeat response from +the member stating that it is either in `SECONDARY`, `RECOVERING`, or `ROLLBACK` state, that primary +schedules an automatic reconfig to remove the corresponding `newlyAdded` field. Note that we filter +that field out of `replSetGetStatus` responses, but it is always visible in the config stored on +disk. + # Reconfiguration MongoDB replica sets consist of a set of members, where a *member* corresponds to a single |