-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZOOKEEPER-4471: Match removing WatcherType to standard, persistent modes #1998
Conversation
9b3a2f3
to
287c86e
Compare
We are approaching ZOOKEEPER-4472.
Combine them all, we will have orthogonal watcher modes for clients. Watching or un-watching a path in one mode will not break other watching modes on same path. |
Before ZOOKEEPER-1416, `WatcherType.Children` was used to remove watchers attached through `ZooKeeper.getChildren`. `WatcherType.Data` was used to remove watchers attached through `ZooKeeper.getData` and `ZooKeeper.exists`. ZOOKEEPER-1416 adds `AddWatchMode.PERSISTENT`. This watcher could be completed remove using `WatcherType.Any`. But when removing through `WatcherType.Data` or `WatcherType.Children`, part of `AddWatchMode.PERSISTENT` will be left behind. And we get persistent children or data watchers. We are never claiming to support these type of watchers. So fix it. In rare chance, we are going to support persistent data or children watchers in future, I think we probably don't want to do such "magic" thing in ZooKeeper. So fix it. This is a step towards ZOOKEEPER-4472 which proposed to support `WatcherType.Persistent` and `WatcherType.PersistentRecursive` to remove persistent watchers.
287c86e
to
33da8ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
I found it somewhat hard to follow in self-review. Add given-when-then comments from my best hope for reviewing and maintenance.
Failure test case run reported at ZOOKEEPER-4512. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Great! Thank you for reviewing! @tisonkun @eolivelli The cpp tests hang, I will reopen this pr for another ci run. |
This is the link to previous ci run, the cpp tests hang for almost 5 hours. https://github.com/apache/zookeeper/actions/runs/5251856628/jobs/9487231863 |
All checks are green. Can we merge this and move forward to #2006 ? @eolivelli @tisonkun |
I think it's good to go. Merging... Thanks for your contribution @kezhuw! |
…des (apache#1998) * ZOOKEEPER-4471: Match removing WatcherType to standard, persistent modes Before ZOOKEEPER-1416, `WatcherType.Children` was used to remove watchers attached through `ZooKeeper.getChildren`. `WatcherType.Data` was used to remove watchers attached through `ZooKeeper.getData` and `ZooKeeper.exists`. ZOOKEEPER-1416 adds `AddWatchMode.PERSISTENT`. This watcher could be completed remove using `WatcherType.Any`. But when removing through `WatcherType.Data` or `WatcherType.Children`, part of `AddWatchMode.PERSISTENT` will be left behind. And we get persistent children or data watchers. We are never claiming to support these type of watchers. So fix it. In rare chance, we are going to support persistent data or children watchers in future, I think we probably don't want to do such "magic" thing in ZooKeeper. So fix it. This is a step towards ZOOKEEPER-4472 which proposed to support `WatcherType.Persistent` and `WatcherType.PersistentRecursive` to remove persistent watchers. * Refactor newly added tests in WatchManagerTest I found it somewhat hard to follow in self-review. Add given-when-then comments from my best hope for reviewing and maintenance.
…des (apache#1998) (#51) * ZOOKEEPER-4471: Match removing WatcherType to standard, persistent modes Before ZOOKEEPER-1416, `WatcherType.Children` was used to remove watchers attached through `ZooKeeper.getChildren`. `WatcherType.Data` was used to remove watchers attached through `ZooKeeper.getData` and `ZooKeeper.exists`. ZOOKEEPER-1416 adds `AddWatchMode.PERSISTENT`. This watcher could be completed remove using `WatcherType.Any`. But when removing through `WatcherType.Data` or `WatcherType.Children`, part of `AddWatchMode.PERSISTENT` will be left behind. And we get persistent children or data watchers. We are never claiming to support these type of watchers. So fix it. In rare chance, we are going to support persistent data or children watchers in future, I think we probably don't want to do such "magic" thing in ZooKeeper. So fix it. This is a step towards ZOOKEEPER-4472 which proposed to support `WatcherType.Persistent` and `WatcherType.PersistentRecursive` to remove persistent watchers. * Refactor newly added tests in WatchManagerTest I found it somewhat hard to follow in self-review. Add given-when-then comments from my best hope for reviewing and maintenance. Co-authored-by: Kezhu Wang <kezhuw@gmail.com>
Before ZOOKEEPER-1416,
WatcherType.Children
was used to remove watchers attached throughZooKeeper.getChildren
.WatcherType.Data
was used to remove watchers attached throughZooKeeper.getData
andZooKeeper.exists
.ZOOKEEPER-1416 adds
AddWatchMode.PERSISTENT
. This watcher could be completed remove usingWatcherType.Any
. But when removing throughWatcherType.Data
orWatcherType.Children
, part ofAddWatchMode.PERSISTENT
will be left behind. And we get persistent children or data watchers.We are never claiming to support these type of watchers. So fix it.
In rare chance, we are going to support persistent data or children watchers in future, I think we probably don't want to do such "magic" thing in ZooKeeper. So fix it.
This is a step towards ZOOKEEPER-4472 which proposed to support
WatcherType.Persistent
andWatcherType.PersistentRecursive
to remove persistent watchers.