zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom White <tom.e.wh...@gmail.com>
Subject Re: Watcher guarantees
Date Fri, 13 Feb 2009 21:03:57 GMT
Thanks for your answers. I understand that you have to call getData()
to find the value of the znode, and that it may have been updated
between the watcher being called and the getData() call. So in that
sense you can miss updates. But watches have strong enough guarantees
to allow you to keep up to date with the latest value by repeatedly
setting a new watch after the old one fires.

The situation I was thinking about - and trying to avoid - was not
being notified about z2, and having to wait for a further update z3
before the watch fired (which could be an arbitrary time later),
because it somehow missed z2. Sounds like this doesn't happen.


On Fri, Feb 13, 2009 at 6:21 PM, Mahadev Konar <mahadev@yahoo-inc.com> wrote:
>> If client sets a watcher on a znode by doing a getData operation is it
>> guaranteed to get the next change after the value it read, or can a
>> change be missed?
> The watch is just a notification that the node changed. If you do a getData
> on the node, you their might have been more updates on the node.
> So yes, you can miss changes.
>> In other words if the value it read had zxid z1 and the next update of
>> the znode has zxid z2, will the watcher always get the event for the
>> change z2?
> The watcher will always get an event for zxid z2, but since the watch does
> not have the data with it -- it will have to do getdata for the that node.
>> Thanks,
>> Tom
> Mahadev

View raw message