Quick revision
The short answer
In a Dynamo-style store, the coordinator sends a write to all N replicas of the key and acknowledges the client once W have answered; a read asks R replicas, and if their answers differ, the version with the newest timestamp wins. Three mechanisms repair replicas that missed writes: hinted handoff replays writes to a replica that was down, but only within a limited window; read repair writes the newest value back to stale replicas when a read notices the difference; and anti-entropy repair compares replicas with Merkle trees on a schedule, the only mechanism that fixes data nobody reads, and it must complete within gc_grace_seconds.
What to remember
In this answer, we followed a write to all N replicas with an acknowledgement after W, and a read from R replicas with digests and timestamp comparison. We saw three ways replicas converge: hinted handoff for short outages within max_hint_window, read repair for data that is actually read, and anti-entropy repair with Merkle trees for everything else, which must finish within gc_grace_seconds so deleted data cannot come back.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
In a Dynamo-style store, the coordinator sends a write to all N replicas of the key and acknowledges the client once W have answered; a read asks R replicas, and if their answers differ, the version with the newest timestamp wins. Three mechanisms repair replicas that missed writes: hinted handoff replays writes to a replica that was down, but only within a limited window; read repair writes the newest value back to stale replicas when a read notices the difference; and anti-entropy repair compares replicas with Merkle trees on a schedule, the only mechanism that fixes data nobody reads, and it must complete within gc_grace_seconds.
Why this question is asked
Leaderless stores trade the simplicity of one ordered log for the ability to write to any replica at any time. That means replicas are allowed to disagree, and the system needs several separate mechanisms to make them converge. Interviewers ask about the read and write paths and the three repair mechanisms because each one covers a gap the others leave, and knowing the gaps explains most operational incidents with Cassandra-like databases. In this answer, we will recap the vocabulary, follow a write and a read, and then look at hinted handoff, read repair and anti-entropy repair in turn.
1A Quick Recap of the Vocabulary
Each key is stored on N replicas, the replication factor, chosen by hashing the key onto a ring of nodes. Any node can receive a client request; for that request it acts as the coordinator. W is the number of replicas that must acknowledge a write and R the number that must answer a read before the coordinator replies. In Cassandra these come from the consistency level, such as ONE or QUORUM, where QUORUM with N = 3 means two.
Every value carries a write timestamp, usually in microseconds. When two replicas hold different values for the same cell, the one with the higher timestamp wins. This rule, last write wins, is what makes the repair mechanisms simple: repairing always means copying the newer value to whoever has an older one.
2The Write Path
The client sends a write to some node, which becomes the coordinator. The coordinator sends the write to all N replicas at once, not just W of them, and waits. As soon as W replicas confirm, it reports success to the client. A replica that is down or slow simply misses the write for now; with N = 3 and W = 2, one missing replica does not fail the request.
Notice what this means: after a successful write, some replicas may not have it. The system has promised only that W of them do. Everything that follows is about getting the others there eventually.
3The Read Path
For a read, the coordinator asks R replicas. To save bandwidth, it typically requests the full data from one of them, the fastest, and only a digest, a hash of the data, from the others. If the digests match the data, it returns the result. If they do not, it fetches the full data from those replicas, compares timestamps cell by cell, and returns the newest values.
If W + R > N, the replicas that answered the read overlap with at least one replica that acknowledged the latest successful write, so the read sees it. With N = 3, W = 2 and R = 2, any two readers and any two writers share at least one node.
9 messages in order. Play them, or step through them one at a time.
Replica 3 was not asked; it is fixed only if it is later read, or by anti-entropy repair.
4Hinted Handoff
When the coordinator knows a replica is down, it still accepts the write if W others confirm, and it also stores a hint: a note saying this mutation belongs to that replica. When the replica comes back, the coordinator replays its hints to it. For short outages, such as a rolling restart, this brings the replica up to date without any further work.
But there is a catch: hints are kept only for a limited window, max_hint_window in Cassandra, three hours by default. If a node is down for longer, writes after that window produce no hints, and the node returns missing them. Hints also live on the coordinators, so if a coordinator dies, its hints are gone. Hinted handoff is a fast path for short outages, not a guarantee.
5Read Repair
In the sequence above, the coordinator noticed that replica 2 had an older value and wrote the newer one back. That is read repair. In Cassandra 4.0 and later, this repair is blocking for the replicas involved in the read, so the coordinator waits for it before answering, which also prevents a later quorum read from seeing an older value.
Read repair has a clear limit: it only fixes what is read, and only among the replicas the read touched. A read at ONE compares nothing. A row that is never read stays inconsistent forever, so read repair cannot be the main mechanism.
6Anti-Entropy Repair With Merkle Trees
Anti-entropy repair is the scheduled, complete mechanism. For a range of tokens, each replica builds a Merkle tree: the data is split into many small ranges, each leaf holds a hash of one range, and each parent holds a hash of its children. Replicas exchange trees and compare them from the top. Where a hash matches, the whole subtree is identical and is skipped; where it differs, they go down until they find the small ranges that differ, and stream just those.
This is the only mechanism that makes rarely read data converge, so it must run regularly on every node, usually through a tool such as Cassandra Reaper or incremental repair. It also has a deadline. A delete in Cassandra writes a tombstone, a marker that the data is deleted, which is kept for gc_grace_seconds, ten days by default, and then purged during compaction. If a replica missed the delete and repair does not reach it before the tombstone is purged elsewhere, the old value on that replica looks live and repair copies it back: deleted data reappears. So every range must be repaired at least once within gc_grace_seconds.
7Follow-up questions
Why does the coordinator send the write to all N replicas if it only waits for W?
So that, in the normal case, every replica gets every write and the repair mechanisms have little to do. W only decides when the client is told the write succeeded.
Which mechanism handles a node that was down for a day?
Hinted handoff covers only the first three hours by default, and read repair only what is read, so the node needs an anti-entropy repair of its ranges, ideally before it serves reads again.
Why compare digests instead of full values?
A digest is small, so for the usual case where replicas agree, the read costs one full response and a few hashes. Full data is requested only when a mismatch is found.
8Conclusion
In this answer, we followed a write to all N replicas with an acknowledgement after W, and a read from R replicas with digests and timestamp comparison. We saw three ways replicas converge: hinted handoff for short outages within max_hint_window, read repair for data that is actually read, and anti-entropy repair with Merkle trees for everything else, which must finish within gc_grace_seconds so deleted data cannot come back.
Open with
In a Dynamo-style store, any node can coordinate a request. For a write, the coordinator sends the mutation to all N replicas of the key, and as soon as W of them acknowledge, it tells the client the write succeeded; replicas that were down or slow just miss it for now.
Then, if they want more
For a read, it asks R replicas, typically the full value from one and digests from the others. If they disagree, it compares timestamps and the newest value wins. With W plus R greater than N, the read always overlaps the latest successful write. Then there are three ways to bring replicas back in sync.
Hinted handoff: when a replica is down, the coordinator keeps a hint and replays it when the replica returns, but only for max_hint_window, three hours by default in Cassandra, so long outages are not covered.
Read repair: when a read sees differing versions, the coordinator writes the newest value back to the stale replicas it read from; since Cassandra 4 that is blocking, but it only fixes data that is read.
Anti-entropy repair: a scheduled nodetool repair builds Merkle trees over token ranges on each replica, compares them top-down, and streams only the ranges that differ. It is the only mechanism that converges rarely read data, and it must cover every range within gc_grace_seconds, ten days by default, or a missed delete can resurrect deleted data.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Walk through the write and read paths in such a store, and explain the three mechanisms...": https://scrivio-interview-library.netlify.app/architecture/partitioning-and-replication/ca9c05a172/