-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[pulsar-broker] Dispatch messaages to consumer with permits #10417
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
|
Thank you @rdhabalia for working on a fix. |
| while (entriesToDispatch > 0 && totalAvailablePermits > 0 && isAtleastOneConsumerAvailable()) { | ||
| int firstAvailableConsumerPermits = getFirstAvailableConsumerPermits(); | ||
| int currentTotalAvailablePermits = Math.max(totalAvailablePermits, firstAvailableConsumerPermits); | ||
| while (entriesToDispatch > 0 && currentTotalAvailablePermits > 0 && firstAvailableConsumerPermits > 0) { |
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.
isn't there a difference in behavior here now that firstAvailableConsumerPermits > 0 is evaluated once before the while loop and previously isAtleastOneConsumerAvailable() would get evaluated each time the while loop evaluates the condition?
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 catching it. yes, I missed to push the commit. fixed now.
f70352b to
4fad5f5
Compare
lhotari
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.
LGTM
|
/pulsarbot run-failure-checks |
1 similar comment
|
/pulsarbot run-failure-checks |
|
@rdhabalia Please update the description of this issue so it doesn't automatically close #6054 since we determined that this PR is only a partial fix for that issue. I'll update the issue with our latest findings. |
|
/pulsarbot run-failure-checks |
|
BTW, to any reviewers, I have tested this branch on a custom build of Pulsar, and it works as expected. |
* [pulsar-broker] Dispatch messaages to consumer with permits * move test (cherry picked from commit 3550f2e)
Motivation
This will fix #6054 , It happens when a topic which has batch messages, subscription has multiple consumers and if some of those consumers' receive more messages than available-permits (due to unequal batch distribution which will be fixed by #7266) and if they are slow then totalAvailablePermits become -ve for that subscription and broker will not dispatch messages to the consumes which still have permits.
Modification
The broker should dispatch messages if any of the consumers of subscription has permits available so, stuck/slow consumer doesn't impact other good consumers.
Result
It should fix #6054
cc @devinbost