[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13671278#comment-13671278
 ] 

Flavio Junqueira commented on ZOOKEEPER-1667:
---------------------------------------------

This is a pretty good issue to discuss, [~fanster.z], but I'm not sure I 
entirely agree with the modifications you're proposing. First, I went back to 
the documentation to see what we have to say about it and we are not very 
precise, so I think we need to also work on documentation for this issue 
because it changes semantics, right?

The patch you're proposing changes the behavior of data watches and exists 
watches, but not of children watches. It changes the structure of child watches 
loop, but functionally it is the same. 

For data watches, you're getting rid of NodeCreated events because you feel 
that it should be NodeDataChanged. I actually can see us going either way, 
although I feel that a NodeCreated event can be informative even for a data 
watch. It is telling the application that the data has changed because the 
znode was recreated. You may want to know it in situations like master changes. 
Also, I'm not sure it makes sense to remove NodeCreated but not NodeDeleted. 
Deleting a znode is also a way of changing its data.

For exists watches, sending a NodeDataChanged gives some additional information 
to the application in the case it has been disconnected. Not only the znode 
already exists, but its data also changed in the meanwhile. But, the current 
code seems to always return NodeDataChanged because czxid and mzxid are set to 
the same value upon creation. We need to fix at least that by perhaps checking 
if mzxid == czxid.
                
> 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

Reply via email to