kaisun2000 commented on a change in pull request #1035:
URL: https://github.com/apache/helix/pull/1035#discussion_r432283984



##########
File path: 
zookeeper-api/src/main/java/org/apache/helix/zookeeper/zkclient/ZkClient.java
##########
@@ -1304,7 +1356,11 @@ private void fireDataChangedEvents(final String path, 
Set<IZkDataListenerEntry>
           public void run() throws Exception {
             if (!pathStatRecord.pathChecked()) {
               // getStat will re-install watcher only when the path exists
-              pathStatRecord.recordPathStat(getStat(path, pathExists), 
notificationTime);
+              if (!pathExists) {
+                pathStatRecord.recordPathStat(getStat(path, false), 
notificationTime);
+              } else {
+                pathStatRecord.recordPathStat(getStat(path, true, true), 
notificationTime);

Review comment:
       Old logic, if pathExists is false, it would not install watch using 
exist() call; otherwise, use exists() call to install the watch.
   
   New logic, if pathExits is false, it would not install watch using exist() 
call; otherwise, use getData() call to istall the watch.
   
   New approach would not leak watch if async deletion happens in between. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to