-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] fix getMaxReadPosition in TransactionBufferDisable should return latest #24898
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
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.
The change makes sense to me since there's other logic in ManagedLedger/ManagedCursor to avoid reading beyond last confirmed entry.
@TakaHiR07 Would it be possible to add some tests?
It is hard to add test for the case in #23027. Besides, This pr just revert the getMaxReadPosition() implementation to version-2.9.x, but there is a potential issue may be need to consider. DispatcherRateLimiter may not work well in a corner case. For example, one topic set a small rate for topic-level dispatcherRateLimiter, and then multiple subscription try to consume one by one. But topic has no new message writing, so all the subscription would become waitingCursor and wait to be notify once new message publish successful. So if new message publish, all the subscription can read message in the same time, maybe exceed the rate of dispatch. To some degree, getMaxReadPosition() return lastConfirmedEntry can avoid this corner case . But it is not reasonable because when disable transaction, the maxReadPosition should be latest. Other code implementation should obey this point or it may bring unexpected error. In all, this potential corner issue should not block this pr |
|
Oddly, this change seems to trigger a lot of test failures which might be test flakiness, invalid tests or some other underlying bug. |
|
@TakaHiR07 A lot of tests break consistently with this change. Do you have a chance to investigate? |
fa6527b to
9df0df5
Compare
@lhotari Have fixed, The reason is also the change in pr-21466. Previous pr try to fix a issue about transaction, but there is no need to change the getMaxReadPosition() about non-transaction. So the ServerCnx#getLastMessageId() should return lastConfirmedEntry when transaction disable, as the same as the implementation in before pulsar version. |
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #24898 +/- ##
============================================
- Coverage 74.34% 74.26% -0.09%
- Complexity 33532 33885 +353
============================================
Files 1913 1913
Lines 149419 149422 +3
Branches 17356 17357 +1
============================================
- Hits 111089 110969 -120
- Misses 29480 29600 +120
- Partials 8850 8853 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…ld return latest (apache#24898) Co-authored-by: fanjianye <fanjianye@bigo.sg> (cherry picked from commit b297f1f) (cherry picked from commit 0c9af0a)
…ld return latest (apache#24898) Co-authored-by: fanjianye <fanjianye@bigo.sg> (cherry picked from commit b297f1f) (cherry picked from commit 0c9af0a)
…ld return latest (apache#24898) Co-authored-by: fanjianye <fanjianye@bigo.sg> (cherry picked from commit b297f1f)
…ld return latest (apache#24898) Co-authored-by: fanjianye <fanjianye@bigo.sg> (cherry picked from commit b297f1f) (cherry picked from commit 46d618a)
…ld return latest (apache#24898) Co-authored-by: fanjianye <fanjianye@bigo.sg> (cherry picked from commit b297f1f) (cherry picked from commit 46d618a)
Fixes #23027
Motivation
As shown in the issue, getMaxReadPosition in TransactionBufferDisable should return latest. This implementation is changed in #21466
Modifications
getMaxReadPosition in TransactionBufferDisable return latest
Verifying this change
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-complete