Reading from a Replica After a Write
A replica can serve data copied from another service instance. Whether it sees a newly committed write depends on the replication and read policy.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace an immediate read
A write changes a display name on a primary. A different replica may still hold the prior name when the next lookup arrives. See session consistency.
State the reader's guarantee
A feature needing immediate confirmation can choose a documented route or carry version information. Check when reads see the change under the actual acknowledgement contract.[1]
Test a read just after an acknowledged write
A service writes name version two to its primary. An asynchronously updated replica can still carry version one. The reader's contract may allow that delay or require a way to observe its own write. See reading committed database state.
Before write: primary v1, replica v1
After acknowledgement: primary v2, replica may remain v1
After replication reaches the change: replica v2
Choose freshness from the action users take
A public catalogue can tolerate some lag under its policy. A confirmation page might require the committed revision immediately. Test just after writing and after the replica catches up, using clearly distinct values.