You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/28 04:20:59 UTC

[GitHub] [pulsar] coderzc opened a new pull request, #18234: [fix][broker][branch-2.8] Fix watcher count on ZK increasing indefinitely

coderzc opened a new pull request, #18234:
URL: https://github.com/apache/pulsar/pull/18234

   ### Motivation
   
   I find some z-node only call `exist` and add watcher, but `ExistsWatchRegistration` still will be registered even though the z-node may never be created. this will lead to the watcher count on ZK increasing indefinitely.
   
   ```java
       /** Handle the special case of exists watches - they add a watcher
        * even in the case where NONODE result code is returned.
        */
       class ExistsWatchRegistration extends WatchRegistration {
   
           public ExistsWatchRegistration(Watcher watcher, String clientPath) {
               super(watcher, clientPath);
           }
   
           @Override
           protected Map<String, Set<Watcher>> getWatches(int rc) {
               return rc == 0 ? watchManager.dataWatches : watchManager.existWatches;
           }
   
           @Override
           protected boolean shouldAddWatch(int rc) {
               return rc == 0 || rc == KeeperException.Code.NONODE.intValue();
           }
   
       }
   ```
   
   ### Modifications
   
   Remove watcher if `exist` return `NONODE`.
   Remove unused method in ZkUtils.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: 
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] coderzc closed pull request #18234: [fix][broker][branch-2.8] Fix watcher count on ZK increasing indefinitely

Posted by GitBox <gi...@apache.org>.
coderzc closed pull request #18234: [fix][broker][branch-2.8] Fix watcher count on ZK increasing indefinitely
URL: https://github.com/apache/pulsar/pull/18234


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org