Watches and ZooKeeper operations
The
write
operations in ZooKeeper are atomic and durable. There is the guarantee of a successful write
operation if it has been written to persistent storage on a majority of ZooKeeper's servers. However, the eventual consistency model of ZooKeeper permits reads to log the latest state of the ZooKeeper service, and the sync
operation allows a client to be up-to-date with the most recent state of the ZooKeeper service.
The read
operations in znodes, such as exists
, getChildren
, and getData
, allow watches to be set on them. On the other hand, the watches triggered by znode's write
operations, such as create
, delete
, and setData
ACL operations do not participate in watches.
The following are the types of watch events that might occur during a znode state change:
NodeChildrenChanged
: A znode's child is created or deletedNodeCreated
: A znode is created in a ZooKeeper pathNodeDataChanged
: The data associated with a znode is updatedNodeDeleted
: A znode...