[
https://issues.apache.org/jira/browse/ZOOKEEPER-1667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13676717#comment-13676717
]
Jacky007 commented on ZOOKEEPER-1667:
-------------------------------------
I get the definition in zookeeper.h
{quote}
/**
* @name Watch Types
* These constants indicate the event that caused the watch event. They are
* possible values of the first parameter of the watcher callback.
*/
// @{
/**
* \brief a node has been created.
*
* This is only generated by watches on non-existent nodes. These watches
* are set using \ref zoo_exists.
*/
extern ZOOAPI const int ZOO_CREATED_EVENT;
/**
* \brief a node has been deleted.
*
* This is only generated by watches on nodes. These watches
* are set using \ref zoo_exists and \ref zoo_get.
*/
extern ZOOAPI const int ZOO_DELETED_EVENT;
/**
* \brief a node has changed.
*
* This is only generated by watches on nodes. These watches
* are set using \ref zoo_exists and \ref zoo_get.
*/
extern ZOOAPI const int ZOO_CHANGED_EVENT;
/**
* \brief a change as occurred in the list of children.
*
* This is only generated by watches on the child list of a node. These watches
* are set using \ref zoo_get_children or \ref zoo_get_children2.
*/
extern ZOOAPI const int ZOO_CHILD_EVENT;
{quote}
The only missing one is zoo_get_children /foo will get a ZOO_DELETED_EVENT if
/foo is deleted.
Now, if zk1 set an exists watch on /foo (not exists), we may get a
ZOO_CHANGED_EVENT. I agree with it will have some additional information, but
it is too hard to understand, use or document.
Actually, I prefer to believe it is the original semantics.
> Watch event isn't handled correctly when a client reestablish to a server
> -------------------------------------------------------------------------
>
> Key: ZOOKEEPER-1667
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1667
> Project: ZooKeeper
> Issue Type: Bug
> Components: server
> Affects Versions: 3.3.6, 3.4.5
> Reporter: Jacky007
> Assignee: Jacky007
> Priority: Blocker
> Fix For: 3.5.0, 3.4.6
>
> Attachments: ZOOKEEPER-1667.patch, ZOOKEEPER-1667-r34.patch
>
>
> When a client reestablish to a server, it will send the watches which have
> not been triggered. But the code in DataTree does not handle it correctly.
> It is obvious, we just do not notice it :)
> scenario:
> 1) Client a set a data watch on /d, then disconnect, client b delete /d and
> create it again. When client a reestablish to zk, it will receive a
> NodeCreated rather than a NodeDataChanged.
> 2) Client a set a exists watch on /e(not exist), then disconnect, client b
> create /e. When client a reestablish to zk, it will receive a NodeDataChanged
> rather than a NodeCreated.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira