-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] Fix NPE when drop backlog for time limit. #16235
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
[fix][broker] Fix NPE when drop backlog for time limit. #16235
Conversation
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.
Is it able to add a test?
Maybe try to mock the managed ledger and let the mLedger.getLedgerInfo method return null.
Really. it's hard to add a test. because there existed a race condition with PersistentTopic#slowestReaderTimeBasedBacklogQuotaCheck, see #15663. It's the same issue with #15663, so using the same resolution for this issue. |
(cherry picked from commit d24d827)
(cherry picked from commit d24d827)
(cherry picked from commit d24d827)
Motivation
When broker do
monitorBacklogQuota, there may throw NPE.Below is the related code :
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BacklogQuotaManager.java
Lines 241 to 257 in a3f5289
The root cause is that the slowest consumer ledgerId may be trimmed, so we need to check
ledgerInfo.Documentation
doc-not-needed(Please explain why)