Anti Entropy

Is a mechanism that can be used to detect inconsistency between a replica system.

The mechanism uses Merkle tree to compare the differences in different level of nodes

Example

For example in our Design Key-Value store problem, we have the key from 1 to 12, which is replicated in 2 servers.

First we want to divide into 4 buckets because building with 12 keys will make it too big.

Pasted image 20230627232425.png

Supposed in Figure 6-13, node 8 is not synchronised.

Now we want to create the hash of each value of each key in the bucket.

Pasted image 20230627232519.png

Same concept, we do the same thing up until the root by creating hash value of the hash.

Detect inconsistency

To detect inconsistency, we simply traverse top down of the tree and find the differences.

Pasted image 20230627232553.png

So in Figure 6-16 keep traversing down the tree, we detecting that node 8 is inconsistent. So we can update the value of node 8 in server 2.