/ THE IDEA
Imagine one primary server accepts writes and copies their ordered changes to another server. The replica can serve many reads, but receiving a change and making it visible are separate steps. A write acknowledgement from the primary alone does not prove that this particular replica is ready to show it. One policy sends the user’s follow-up reads to the current primary. Another tracks the position of the completed write in the replication stream, then uses only a replica that has applied at least that far. The application must also start a suitable fresh read rather than reuse an older database snapshot.
THE FORMAL IDEA
serve read when applied_position ≥ required_write_position
| applied_position is how far a replica has replayed changes in one ordered stream. required_write_position identifies a point at or after this session’s completed write. | | ≥ means at least as far. The numbers below are simplified sequence positions, not clock times; real systems may use a database-specific log location or token. |
|
RUN THE TINY EXAMPLE
Change one thing. Predict what happens.
Your saved name change is included by position 125. A replica has applied only through 123. 123 < 125, so it cannot yet satisfy the session’s requirement; wait or use a suitable other server. The replica reaches 127: 127 ≥ 125, so a fresh read can include your change. Change only the required write position to 122: the original replica position 123 would already be sufficient.
|
The gate follows actual progress, not a guessed delay such as always wait one second. A slow connection can make a fixed wait too short; a fast one can make it needless. Progress information answers the causal question directly.
/ SO WHAT?
This session-specific guarantee does not promise everyone’s latest change worldwide. Another user may have written after your required position. A browser or application cache can still show an older screen even if the database selection is correct. The whole read path must preserve the intended guarantee.
ONE CAVEAT |
| Replication positions must refer to the correct history, especially after failover, and waiting needs a deadline and fallback policy. Some synchronous replication modes confirm receipt or durable storage without confirming visibility; applied changes are the relevant milestone for this read guarantee. |
KEEP THIS
To keep a saved edit visible, route the next read to a view known to include that write, not simply to any available copy.
|
NEXT: How a small strip can carry much of a wall’s heat
|