At Thu, 18 Jul 2013 16:45:40 +0800, Liu Yuan wrote: > > > > I noticed zookeeper just send one event to watcher on my test box even if there > > > are multiple updater to one member of the queue. But I think there is problem > > > like above example. I think we need to check if there someone updates the join > > > event already in the queue inside push_join_response(), to allow only one > > > updater thus one update event to watcher of all nodes. > > > > It is not easy to make sure that there is only one updater in the > > cluster. I think of keeping the master of the zookeeper driver in > > this patch. This patch cannot remove the master in either way, and > > introduces another complexity rather than simplifying the code. > > > > Why hard? We can read the zk node and check ev->type == EVENT_ACCEPT or not. no? While pushing a join response, how to prevent another node from updating the same zk node? For example, 1. The node A reads the znode and ev->type is not EVENT_ACCEPT. 2. The node B reads the znode before the node A updates it with EVENT_ACCEPT. 3. The node A calls zk_set_data() with EVENT_ACCEPT. 4. The node B calls zk_set_data() with EVENT_ACCEPT. Thanks, Kazutaka |