-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CURATOR-654: Remove watcher after waiting on barrier. #435
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
Conversation
tisonkun
left a comment
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.
Rest LGTM.
| * | ||
| * @return true if the barrier is set. | ||
| */ | ||
| public synchronized boolean isSet() throws Exception |
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.
Annotated with @VisibleForTesting.
| public void testWatchersRemoved() throws Exception | ||
| { | ||
| CuratorFramework client = mock(CuratorFramework.class); | ||
| WatcherRemoveCuratorFramework watcherRemoveClient = mock(WatcherRemoveCuratorFramework.class); | ||
| ExistsBuilder existsBuilder = mock(ExistsBuilder.class); | ||
|
|
||
| when(client.newWatcherRemoveCuratorFramework()).thenReturn(watcherRemoveClient); | ||
| when(watcherRemoveClient.checkExists()).thenReturn(existsBuilder); | ||
| when(existsBuilder.usingWatcher(any(Watcher.class))).thenReturn(existsBuilder); | ||
|
|
||
| final DistributedBarrier barrier = new DistributedBarrier(client, "/barrier"); | ||
| barrier.waitOnBarrier(1, TimeUnit.SECONDS); | ||
| verify(watcherRemoveClient, atLeastOnce()).removeWatchers(); | ||
| } |
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.
Perhaps add watches and verify the following events triggered:
- DataWatchRemoved
- ChildWatchRemoved
- PersistentWatchRemoved
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.
I guess it might be particular important to test this as ZooKeeper.removeWatches is cheating since ZOOKEEPER-1910. See also kezhuw/zookeeper-client-rust#2.
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.
@kezhuw I agree that it can be a bug as I mentioned in https://lists.apache.org/thread/0kcnklcxs0s5656c1sbh3crgdodbb0qg. You can reply on the mailing list and file an issue.
tisonkun
left a comment
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.
See comments above.
|
Closing as inactive... @kezhuw maybe you're interested in taking over this issue? |
No description provided.