Ask which version a read is allowed to see
Picture
One user writes a note, then reads an older replica. Eventual convergence and read-your-writes are different guarantees.
Predict
Does eventual consistency alone guarantee that your next read sees your own last write?
Walk through the small example
No. Read-your-writes needs an additional routing or version guarantee.
Mental model and runnable Python model
Linearizability makes completed operations appear in a real-time-respecting single order. Eventual consistency promises convergence under its stated update and communication assumptions, not immediate visibility. Session guarantees such as read-your-writes or monotonic reads address narrower user-visible properties. During a network partition, a system cannot guarantee both linearizable behavior and a successful response to every request under the CAP model’s assumptions. Choose per-operation behavior: a cached public counter may tolerate staleness, while claiming a unique seat may reject unavailable coordination. Conflict resolution must match the domain; last-write-wins can discard updates and depends on timestamp assumptions.
What the function promises: The model checks whether a replica version satisfies a required minimum. It is not a consistency protocol or proof of linearizability.
def read_at_least(replica, required_version):
version, value = replica
if version < required_version:
raise RuntimeError("Replica is behind; wait or route elsewhere")
return value
assert read_at_least((7, "new"), 7) == "new"
try:
read_at_least((6, "old"), 7)
except RuntimeError:
pass
else:
raise AssertionError("Stale replica served a required-newer read")
Work and storage: O(1) version comparison; obtaining trustworthy versions and routing adds protocol work.
When to recognize it: It does not mean “pick any two” for every normal request. State which operations favor availability and which must preserve stronger consistency.
Check before applying it: Consistency names describe specific guarantees; CAP is not a blanket “choose two technologies” rule.
Change one rule
Two disconnected writers edit different fields of the same object. Must last-write-wins preserve both edits?
See what changes
No. It can discard one whole update. Consider field-aware merging, version checks, operation-based conflict resolution, or coordination according to the business invariant.
Connect
Copies, lag, leaders, and agreement: Replica lag and failover determine which versions a reader can see.
Commit the change and its event together: An outbox makes one local state change and its event intent atomic.