Tom White wrote:
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.
If it does please enter a JIRA. ;-)
On Fri, Feb 13, 2009 at 6:21 PM, Mahadev Konar <maha...@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
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.