Github user afine commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/136#discussion_r132023758
  
    --- Diff: src/java/main/org/apache/zookeeper/server/WatchManager.java ---
    @@ -97,23 +102,44 @@ synchronized void removeWatcher(Watcher watcher) {
         Set<Watcher> triggerWatch(String path, EventType type, Set<Watcher> 
supress) {
             WatchedEvent e = new WatchedEvent(type,
                     KeeperState.SyncConnected, path);
    -        HashSet<Watcher> watchers;
    +        Set<Watcher> watchers = new HashSet<>();
    +        PathIterator pathIterator = new PathIterator(path);
             synchronized (this) {
    -            watchers = watchTable.remove(path);
    -            if (watchers == null || watchers.isEmpty()) {
    -                if (LOG.isTraceEnabled()) {
    -                    ZooTrace.logTraceMessage(LOG,
    -                            ZooTrace.EVENT_DELIVERY_TRACE_MASK,
    -                            "No watchers for " + path);
    +            for (String localPath : pathIterator.asIterable()) {
    --- End diff --
    
    I'm not sure if we should consider a potential performance impact for tall 
data trees since we now always iterate all the way up every time a watcher is 
triggered. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to