On Thu, Jul 18, 2013 at 05:56:05PM +0900, MORITA Kazutaka wrote: > 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. I can't testify it, but I notice following scenario: 1 A and B try to update one zk node in a very short time window 2 the sequence might be (A, B) or (B, A), but it doesn't matter. 3 zookeeper will only send one update event! I guess if the time windoe is less than a specific time in zk, it just notify one update event for that node. My zk is 3.3.5. Kai, can you verify this? Thanks Yuan |