How it works
Hints and read-time fixes reach only what they touch, so replicas can still drift when a hint expires or a key is rarely read. Anti-entropy is a background process that compares replicas responsible for the same range and copies what differs. Sending every key to compare would be wasteful. A Merkle tree hashes groups of keys and values upward: each leaf hashes a small key range, each parent hashes its children, and the root summarizes the whole range.
As an example, two replicas hold 1 million keys under a tree with 1,024 leaves, about 1,000 keys per leaf. Their roots differ, so they compare the two children. The left hashes match, which skips half the range in one step. Following the differing branch down 10 levels takes about 20 hash comparisons and ends at one leaf, so roughly 1,000 keys are examined instead of 1 million. The narrowing fades if differences are scattered across most leaves. The tree detects differences, but does not decide which value is authoritative; versions do that.
Repair also needs deletion metadata. If a delete simply removed the key, a replica that missed it would seem to hold new data, and repair would copy the value back. So a delete writes a tombstone, a marker recording the deletion and its version, retained long enough for every replica to learn of it. Cassandra’s default is ten days, and a node down for longer should be rebuilt rather than rejoin. Longer retention costs disk and slows reads. Rate-limit repair so foreground traffic remains healthy.
A replica returns after missing a delete, and its old value reappears. What was missing?
A retained versioned tombstone. Repair must propagate the delete instead of treating the stale value as new data.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Merkle comparisons narrow the ranges that differ.
- Tombstones and version choice make convergence safe.