Apache ZooKeeper: How do writes work

Apache ZooKeeper is a kind of high available data-store for small objects. A ZooKeeper cluster consists of some nodes which all keep the whole dataset in their memory. The dataset is called "always-consistent", so every node has the same data at every time.

According to the documentation and blog posts, every node in the cluster can answer reads and accept writes.

  • Reads are always answered locally by the node, so no communication with the cluster is involved.
  • Writes are forwarded to a designated "Leader" node, which forwards the write-request to all nodes and waits for their replies. If at least half of the nodes answers, the write is considered successful.

Question: Why is it enough for the leader to wait for half of the nodes to reply? If somebody connects to one of the nodes which didn't receive the update, he gets an outdated result (only local read to local value).

21
задан Ben 19 February 2015 в 20:32
поделиться