I am trying to understand why ZAB is required when Paxos does the same thing. I read multiple documentations and articles and all summed up that Zookeeper requires the instructions to be in the exact same order. But with basic paxos, doesn't the leader pitch messages for the log with the exact indexes? So even if the messages are reordered, eventually the messages would go to the exact same log index and end up with the exact same log. So, doesn't it mean that in Paxos, all replicas get the same instructions in the exact same order?
So please answer my questions in the order like
- What exactly is message reordering and why Paxos cannot handle it?
- Paxos was not originally intended for atomic broadcasting? By Atomic broadcasting, they mean to achieve the total order. But by putting the messages in the same indexes in the replicas' logs, doesn't Paxos achieve the total order eventually?
References.
- https://distributedalgorithm.wordpress.com/2015/06/20/architecture-of-zab-zookeeper-atomic-broadcast-protocol/
- http://www.tcs.hut.fi/Studies/T-79.5001/reports/2012-deSouzaMedeiros.pdf
- https://zookeeper.apache.org/doc/r3.3.6/zookeeperInternals.html
- https://www.linkedin.com/pulse/zab-consensus-algorithm-yeshwanth-n/
May I refer you to https://en.wikipedia.org/wiki/Atomic_broadcast ?
Consensus and atomic broadcast are equivalent to each other (as described in the link). So either can be used.
Paxos, technically, is a family of protocols. When one gets to a practical implementation, lots of edge cases need to be covered. E.g. nodes coming online and offline in an efficient way, nodes replacement, log archiving, etc.
ZAB is protocol which supports all of those cases according to specs needed by designers.
As a summary: both paxos and zab (and others) provide correctness, but these protocol differ in efficiency.
Edit after links added to the question:
From one of links:
Atomic Broadcast Guarantee: Zab guarantees atomic broadcast, meaning that either all nodes receive a message in the same order or none of them receive it. This ensures consistency across the distributed system and prevents inconsistencies caused by message reordering or losses.
Those reorderings and losses are about messages being passed in unreliable networks. And atomic broadcast guarantees that even with unstable networking, all nodes get all messages in the same order.
Since atomic broadcast and consensus are the same thing, one can use either to reach this goal. So both ZAB and Paxos can be used.
Your questions:
Paxos handles reordering (of messages on network layer) just fine.
Paxos was presented in a research paper about consensus. If I remember correctly, the original work was able to run a consensus round once, agreing on a single value. Paxos extensions are able to handle stream of values, which makes it look like atomic broadcast (which it is due to consensus and atomic broadcast being the same thing).
If one wants to replace ZAB with Paxos, they totally can. Probably some efficiency will be lost, but the correctness is still there. Here is more info: https://cwiki.apache.org/confluence/display/ZOOKEEPER/Zab+vs.+Paxos