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

CURATOR-654: Remove watcher after waiting on barrier. #435

Closed
wants to merge 1 commit into from

Conversation

stulscott
Copy link

No description provided.

@stulscott stulscott changed the title [CURATOR-654] Remove watcher after waiting on barrier. CURATOR-654: Remove watcher after waiting on barrier. Oct 6, 2022
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.

Rest LGTM.

*
* @return true if the barrier is set.
*/
public synchronized boolean isSet() throws Exception
Copy link
Member

Choose a reason for hiding this comment

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

Annotated with @VisibleForTesting.

Comment on lines +262 to +275
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();
}
Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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.

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.

See comments above.

@tisonkun
Copy link
Member

Closing as inactive...

@kezhuw maybe you're interested in taking over this issue?

@tisonkun tisonkun closed this Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants