Replicas Drift Apart
In a leaderless system a write may not reach every replica, perhaps because a node was down. Over time replicas diverge. Two repair mechanisms restore agreement without a leader.
Read Repair
When a read gathers responses from several replicas, the coordinator may notice that some return stale versions. It returns the freshest value to the client and, in the background, writes the latest version back to the stale replicas. This piggybacks repair on normal reads, so frequently read data stays consistent cheaply.
Anti Entropy
Read repair only fixes data that gets read. Anti entropy is a background process that compares replicas directly and syncs differences, covering rarely read keys too. To avoid shipping entire datasets, replicas exchange Merkle trees, hash trees that let two nodes quickly pinpoint exactly which ranges differ and transfer only those.
Working Together
Read repair handles hot data on the fly while anti entropy sweeps the long tail, so together they bound how stale any replica can become.
Key idea
Read repair fixes stale replicas during normal reads while anti entropy uses Merkle trees to sync rarely read data in the background, together keeping leaderless replicas convergent.