Introduction to Data Replication 00:00:01 Can a nearby catalog answer the lunch rush A catalog primary serves every lookup and update. The team adds replicas to carry nearby reads. First decide when a newly copied catalog has enough history to answer its assigned readers. It holds A, B and C and does all the work. If it dies, everything stops. It starts from a full copy and then follows. Until it has caught up it must not serve reads. The primary sends its change log. The replica applied D. More of the reads can move to it. Replicas can still answer reads, if the application lets them. Nobody can write. US-East becomes the primary and takes writes. The other two follow it and share the reads. Replicas can increase read capacity and offer promotion candidates. The system still needs an authority for writes, fencing for an old primary, and clear promises about freshness. 00:01:00 A payment balance and a product description Two requests arrive together. One authorizes a payment against a balance and the other displays a product description. They have different tolerance for an old answer. All writes go to the primary. The balance before a payment is read from the primary. A product page may be slightly old. Replica 1 answers. The following read goes to replica 2. Replica 2 is 40 seconds behind, so it is skipped until it has caught up. The primary takes only as many reads as it has room for. The rest fail fast. Route by the operation's correctness contract and measured lag. A payment authorization needs an atomic authoritative decision even if a preliminary balance display was fresh. 00:01:51 Two shops edit one price Two regional leaders start with a price of ten. A broken link lets both accept changes. Predict whether a timestamp winner can preserve both editors' intentions. Both leaders hold a price of 10. Both regions go on accepting writes. That is the point of having two leaders. The US sets 12, the EU sets 9 a second later. Neither knows about the other. The leaders exchange changes and see two values for one row. The EU write is newer, so 9 stays. The US change disappears without an error. A last-write-wins rule can converge while discarding an update. Clock assumptions and tie-breaking matter, and inventory reservations may need coordination rather than one surviving price. 00:02:43 One of three copies missed the write Three nodes store a versioned record. A write receives two confirmations, and a returning node still has the older value. Follow a read that encounters both versions. The coordinator sends version 2 to every copy. W is 2, so the write succeeded although node 3 missed it. It is back, with the old version. Nodes 2 and 3 answer. They disagree, and the newer version wins. The coordinator writes v2 back to node 3. In this trace the versions have an unambiguous order. A coordinator can repair the lagging copy, while concurrent incomparable versions require the system's explicit conflict policy. 00:03:29 Every replica faithfully copies a mistake An operator accidentally deletes every order on the primary. Before advancing the log, predict what the replicas are supposed to do with that valid deletion. Primary and two replicas hold all the orders. Somebody deletes every order on the primary. The replicas did their job: they copied the delete. Restoring an earlier point requires separate retained history and a tested recovery path. A perfectly current replica faithfully carries the very mistake the operator needs to undo.