Read Repair
In plain English
Plain definition
When a client reads a value from a leaderless database, the coordinator checks several replicas at once. If they disagree, it fixes the mismatch on the spot by pushing the correct value to the stale replicas, so the act of reading also heals inconsistent data.
Read Repair operates at the coordinator node during a quorum read. When a client requests a key with read consistency R, the coordinator queries N replicas (or at least R of them) and compares the returned values using version metadata — typically a Vector Clock, timestamp, or Lamport-style counter. If replicas disagree, the coordinator resolves the conflict (last-write-wins, causal merge, or CRDT-style merge depending on the data model) and asynchronously pushes the resolved value back to the stale replicas before or after returning the response to the client, depending on whether the system implements blocking (synchronous) or non-blocking (async, fire-and-forget) repair.
There are two operational modes worth distinguishing:
- Read-triggered repair (foreground): Repair only occurs on keys that are actually read. This means cold, rarely-accessed keys can drift indefinitely and never self-heal, which is why systems like Cassandra pair this with a scheduled
nodetool repair(Merkle-tree-based anti-entropy) as a backstop for the entire keyspace. - Digest-based optimisation: To avoid transmitting full payloads from every replica on every read, coordinators often request full data from one replica and lightweight digests (hashes) from the others. If digests mismatch, a full-value re-read is triggered — this is the digest-mismatch pattern used by Cassandra (which triggers a full data read and repair regardless of any probabilistic setting; the legacy
read_repair_chancetable option was removed in Cassandra 4.0), and it materially changes tail latency because a digest mismatch converts a fast quorum read into a multi-round-trip operation.
The critical engineering tradeoff is consistency probability vs. tail latency. Blocking read repair (waiting for the repair write to succeed before acknowledging the client) increases R-quorum consistency guarantees but couples read latency to the slowest straggler replica’s write ack — a direct vector for Head-of-Line Blocking-style latency amplification under partial degradation. Non-blocking repair keeps read latency flat but means the client can still observe stale data on a subsequent read if it happens to hit an unrepaired replica before the async write lands, which is a real consideration when reasoning about session consistency or read-your-writes guarantees on top of a leaderless store.
Read repair also interacts poorly with high-cardinality, low-read-frequency workloads and with deletes: if a delete is represented as a Tombstone and that tombstone is purged after gc_grace_seconds before a replica that missed the delete has received it, the stale value on that replica can be propagated back and effectively resurrect deleted data (read repair itself favours the newer tombstone over older data) — this is precisely why tombstone GC-grace-period tuning and full anti-entropy repair windows must be coordinated so that grace periods always exceed the maximum expected repair convergence time; in practice, a full repair must complete on every node within gc_grace_seconds. Systems that expose tunable read repair let operators trade CPU/network overhead against staleness risk.
Related reading
Legacy Reference
https://cassandra.apache.org/doc/latest/cassandra/architecture/dynamo.html#read-repairAbout this page
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Recommended reading
More from KBY that goes with this term.
