kezhuw commented on code in PR #1859:
URL: https://github.com/apache/zookeeper/pull/1859#discussion_r1120020783


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/DataTree.java:
##########
@@ -684,7 +684,9 @@ public String getMaxPrefixWithQuota(String path) {
     public void addWatch(String basePath, Watcher watcher, int mode) {
         WatcherMode watcherMode = WatcherMode.fromZooDef(mode);
         dataWatches.addWatch(basePath, watcher, watcherMode);
-        childWatches.addWatch(basePath, watcher, watcherMode);
+        if (watcherMode != WatcherMode.PERSISTENT_RECURSIVE) {
+            childWatches.addWatch(basePath, watcher, watcherMode);
+        }

Review Comment:
   No. For sole `WatcherMode.PERSISTENT_RECURSIVE`, there is no 
`EventType.NodeChildrenChanged` delivered as old code do filter in 
`WatcherManager#triggerWatch`.
   
   
https://github.com/apache/zookeeper/blob/de8768807fc7a3fcabc9762b033cf59e695cf14b/zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatchManager.java#L137-L141
   
   The above changes do such filter in first place to reduce coding burden in 
`triggerWatch` phase.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to