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

Rakesh R commented on ZOOKEEPER-1910:
-------------------------------------

OK got it. I could see an alternative approach using different opcodes - 
checkWatches & removeWatches. Any thoughts ?

zk#removeWatches() api will send 'opCode.checkWatches' request to the server 
and returns errCode, now the client will see errCode and remove watches locally.
zk#removeAllWatches() api will send 'opCode.removeWatches' request to the 
server, this will remove watches from server and client as well.
{code}
ZooDefs.OpCode.checkWatches // check watches exists in server and return errCode
CheckWatchesRequest implements Record{
     String path
     int type
}

ZooDefs.OpCode.removeWatches // remove watches from server and return errCode
RemoveWatchesRequest implements Record{
      String path
      int type
}
{code}

> RemoveWatches wrongly removes the watcher if multiple watches exists on a path
> ------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1910
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1910
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1910.patch, ZOOKEEPER-1910.patch, 
> ZOOKEEPER-1910.patch
>
>
> Consider a case where zkclient has added 2 data watchers(say 'w1' and 'w2') 
> on '/node1'.
> Now user has removed w1, but this is deleting the 'CnxnWatcher' in ZK server 
> against the "/node1" path. This will affect other data watchers(if any) of 
> same client on same path. In our case 'w2' would not be notified.
> Note: please see the attached test case to understand more.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to