Skip to content
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

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

kezhuw
Copy link
Member

@kezhuw kezhuw commented May 6, 2023

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.

@kezhuw kezhuw force-pushed the ZOOKEEPER-4471-remove-watches branch 3 times, most recently from 9b3a2f3 to 287c86e Compare May 6, 2023 19:01
@kezhuw
Copy link
Member Author

kezhuw commented May 8, 2023

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.

cc @eolivelli @tisonkun @Randgalt @symat @maoling @cnauroth

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.
Copy link
Contributor

@eolivelli eolivelli left a 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.
@kezhuw
Copy link
Member Author

kezhuw commented Jun 13, 2023

Failure test case run reported at ZOOKEEPER-4512.

@kezhuw kezhuw closed this Jun 13, 2023
@kezhuw kezhuw reopened this Jun 13, 2023
Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@kezhuw
Copy link
Member Author

kezhuw commented Jun 13, 2023

Great! Thank you for reviewing! @tisonkun @eolivelli

The cpp tests hang, I will reopen this pr for another ci run.

@kezhuw kezhuw closed this Jun 13, 2023
@kezhuw kezhuw reopened this Jun 13, 2023
@kezhuw
Copy link
Member Author

kezhuw commented Jun 13, 2023

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

@kezhuw
Copy link
Member Author

kezhuw commented Jun 13, 2023

All checks are green. Can we merge this and move forward to #2006 ? @eolivelli @tisonkun

@tisonkun
Copy link
Member

I think it's good to go. Merging...

Thanks for your contribution @kezhuw!

@tisonkun tisonkun merged commit b8d458f into apache:master Jun 13, 2023
36 of 38 checks passed
anurag-harness pushed a commit to anurag-harness/zookeeper that referenced this pull request Aug 31, 2023
…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.
anurag-harness added a commit to anurag-harness/zookeeper that referenced this pull request Aug 31, 2023
…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>
@kezhuw kezhuw deleted the ZOOKEEPER-4471-remove-watches branch September 24, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants