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 08:13:13 UTC
[GitHub] [pulsar] codelipenghui commented on a diff in pull request #18235: [fix][broker][branch-2.8] Fix watcher count on ZK increasing indefinitely
codelipenghui commented on code in PR #18235:
URL: https://github.com/apache/pulsar/pull/18235#discussion_r1007782116
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java:
##########
@@ -206,6 +203,14 @@ private void existsFromStoreInternal(String path, CompletableFuture<Boolean> fut
if (code == Code.OK) {
future.complete(true);
} else if (code == Code.NONODE) {
+ // remove watcher if node does not exist
+ zkc.removeAllWatches(path, Watcher.WatcherType.Any, true,
+ (rc0, path0, ctx0) -> {
+ Code code0 = Code.get(rc0);
+ if (code0 != Code.OK && code0 != Code.NOWATCHER) {
+ log.warn("Remove watcher failed. rc: {}, path: {}", code0, path);
Review Comment:
Please check all.
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java:
##########
@@ -206,6 +203,14 @@ private void existsFromStoreInternal(String path, CompletableFuture<Boolean> fut
if (code == Code.OK) {
future.complete(true);
} else if (code == Code.NONODE) {
+ // remove watcher if node does not exist
+ zkc.removeAllWatches(path, Watcher.WatcherType.Any, true,
+ (rc0, path0, ctx0) -> {
+ Code code0 = Code.get(rc0);
+ if (code0 != Code.OK && code0 != Code.NOWATCHER) {
+ log.warn("Remove watcher failed. rc: {}, path: {}", code0, path);
Review Comment:
```suggestion
log.warn("Remove watcher for non-existing znode failed. rc: {}, path: {}", code0, path);
```
--
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