-
Notifications
You must be signed in to change notification settings - Fork 242
Remove duplicate subscribe in CallBackHandler #1504
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
junkaixue
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.
Can we add an unit test? For example, we invoke the with different changes, we can make sure all changes we subscribe back?
helix-core/src/main/java/org/apache/helix/NotificationContext.java
Outdated
Show resolved
Hide resolved
| subscribeForChanges(changeContext.getType(), _path, _watchChild); | ||
| } else { | ||
| // put SubscribeForChange run in async thread to reduce the latency of zk callback handling. | ||
| subscribeForChangesAsyn(changeContext.getType(), _path, _watchChild); |
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.
Did we try to get rid of async subscribe in this PR and do all subscription synchronously? I thought we only remove the extra one.
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.
TFTR. The duplicated subscribeForChanges in HandleChildChange and do resubscribe for child change in line 361. For data changes, this async subscribe is also duplicated since the path is already resubscribed in zkClient.
TFTR. Let me try. |
47e4507 to
377e221
Compare
e3185ac to
c840da8
Compare
e420e61 to
c2f5eba
Compare
helix-core/src/main/java/org/apache/helix/NotificationContext.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| // verify new watcher is installed on the new node | ||
| Thread.sleep(5000); |
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 think we try to get rid of this kind of thread sleep, and use verifier. But as this is legacy test, I think it's fine. You can let @kaisun2000 know.
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 am not sure if we have watcher or listener installation verifier. If not, may be larger change is needed.
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.
Thanks for offline discuss. Updated.
c1419fa to
49a784d
Compare
junkaixue
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.
I dont have any concerns. But just make sure resolved other comments.
49a784d to
ce0b61d
Compare
|
This PR is ready to be merged. Approved by @dasahcc Commit message: Duplicate subscribes lead to longer time spend when process callbacks in zkClient, witch eventually leads to increased PendingCallback queue size. This PR removes duplicate subscribeForChanges in CallBackHandler to improve performance. |
Issues
Remove duplicate subscribeForChanges in CallBackHandler #1503
Description
During code inspection, We found there are multiple subscribeForChanges being called in CallBackHandler.handelChildChange. This leads to longer time spend when process callbacks in zkClient, witch eventually leads to increased PendingCallback queue size.
This PR removes duplicate subscribeForChanges in CallBackHandler to improve performance.
Tests
NA
Documentation (Optional)
(Link the GitHub wiki you added)
Commits
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)