On Sat, Oct 23, 2010 at 9:03 PM, jingguo yao <yaojing...@gmail.com> wrote:
> Read requests are handled locally at each Zookeeper server. So it is > possible for a read request to return a stale value even though a more > recent update to the same znode has been committed. Does this statement > still hold if the Zookeeper follower serving the read request is the one > which has just served the recent update request? > It's probably good to start with the explicit guarantees: http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html#ch_zkGuarantees Yes (it could still get "stale" data from quorum perspective). The leader may have committed a new change that has not yet been seen by the follower (ie two changes in quick succession) > For example, client A connects to follower X. And client A issues a request > to update znode /a from 0 to 1. After receiving this request, follower X > forwards this request to the leader. Then the leader broadcasts this update > proposal to all the Zookeeper servers. After a quorum of the followers > commit the update request, the update succeeds. Then client A issues a read > request to get the value of znode /a. And follower X receives this read > request. So if follower X is not among the quorum and follower X has not > committed the update to catch up with the leader, it is still possible for > client A to get a stale value of znode /a. In this case, the return value > is > 0. > > Is my understanding correct? That's correct. See the the NOTE in the section (link) I provided above. Patrick