The out of order anomaly
Suppose one user asks a question and another answers it. If a third observer reads from replicas that applied the answer before the question, the conversation appears nonsensical: an answer to a question that has not been asked yet.
Consistent prefix reads guarantee that if a sequence of writes happens in a certain order, anyone reading them sees them in that same order, never with later writes appearing before earlier causally related ones.
Why partitioning breaks it
In a single partition, writes already have a total order, so the problem rarely appears. Trouble comes with sharding: the question and answer may live on different partitions that replicate at different speeds, so an observer can see one without the other.
How to provide it
- Keep causally related writes in the same partition when possible.
- Or track causal dependencies explicitly so a reader waits for the prerequisite write before showing the dependent one.
Key idea
Consistent prefix reads keep causally ordered writes from being observed out of order, a problem that sharding makes real.