Notesreplication🌱 seedling
Read Repair
Also: Blocking Read Repair
When a read sees replicas disagree, write the newest version back to the stale ones. It repairs frequently read data for free, and never touches data nobody reads.
Why it exists
Leaderless replicas have no log to replay. Every read that consults several replicas is already comparing their versions, so it's the natural moment to fix the stale ones.
How it works
- The coordinator collects r responses, picks the newest version (or merges siblings), returns it, and writes it to replicas that returned older data.
- Blocking read repair finishes the repair before replying, which makes quorum reads monotonic: a later quorum read can't return older data than an earlier one.
Trade-offs
| Gains | Costs |
|---|---|
| cheap, on the read path | extra write latency on mismatched reads |
| monotonic quorum reads (blocking) | can break partition-level write atomicity when you read a subset of what was written together |
| no background process | cold data never gets repaired |
In practice
- Cassandra 4.0 removed probabilistic background read repair (
read_repair_chance); repair now runs in the foreground when replicas consulted at the read's consistency level disagree. Tables can setread_repair = 'NONE'to keep write atomicity at the cost of monotonic quorum reads.
Pitfalls
- Relying on it instead of scheduled Anti-Entropy: rarely read keys, and deletes, stay inconsistent.
Connections
Recall
These cards are also in your review deck, scheduled with spaced repetition.