Replication Fundamentals 00:00:01 Receipt is earlier than visibility A library registers a new title. Its primary sends one change record to a replica. Can the replica show the title at the instant the record arrives? The application sends an INSERT to the primary. The primary appends the change to its log, at position 4. The record travels to the replica. The replica's log has it. A reader on the replica still sees 3 rows. Now readers see it. Both copies hold the same data. Track receipt, durable storage and application separately. The moment readers can search the title is the moment its change becomes visible in the replica's read model. 00:00:40 Send the recipe or the result Imagine a database statement that chooses a random value for each updated row. Running the same instruction elsewhere can produce a different assignment. Follow three ways to represent the change. The SQL text is sent. Each copy rolls its own random number, so the copies differ. The value that the primary computed is sent, one record per row. The bytes that changed in the data pages are sent. The copy is exact. For a million rows the statement is one line and the row log holds a million records. That is the trade. Logical records and physical records make different compatibility and volume trade-offs. A row log may grow with affected rows even when one short statement triggered all the work. 00:01:29 Where the acknowledgment comes from An acknowledgment is a promise with a boundary. Mark what survives if the primary disappears immediately after success, then move the promised confirmation to a distant replica. The client hears done at once. The log leaves afterwards. If the primary dies now, the write is gone. The nearest replica confirms after 1 ms. Two machines hold the write. The far replica decides. Every commit takes 70 ms longer. Waiting for both now blocks every write. Waiting for any one goes on. Strict synchronous keeps waiting. MySQL semi-synchronous falls back to asynchronous after its timeout. Name which machines acknowledged and what each persisted. A slower or unavailable required replica can lengthen or block commits, depending on the configured durability and fallback policy. 00:02:26 Can the replica outrun new writes A replica misses thirty seconds of log at twenty megabytes each second. It returns with a replay budget of thirty megabytes per second. Predict its catch-up time. The replica was down for half a minute: 30 s times 20 MB is 600 MB. It replayed 600 MB and 400 MB arrived: 400 MB left. It gains 10 MB a second, so it is current after 60 seconds. At 3 times the writes, 60 MB arrive each second and the replica falls 30 MB further behind each second. The backlog drains at replay rate minus incoming rate. Six hundred megabytes divided by ten megabytes per second gives sixty seconds, assuming both rates remain steady. 00:03:16 Select a replica by applied position The reader who added a title wants to see it immediately. Store a minimum acceptable position with the session and compare it against each candidate's applied progress. The user saves. The session remembers position 5. Replica B is at 4: it does not have the write. Replica A has replayed 5, so the user sees the change. Later, A is at 6 and the session remembers 6. B, still at 4, stays off limits. Only B is left and it is too old, so the primary answers. A minimum position can preserve read-your-writes or monotonic reads on the relevant history. Keep a fallback or wait budget for the case where every reachable follower trails.