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

[fix] [broker] fix NPE when calculating a topic's backlogQuota #23720

Conversation

poorbarcode
Copy link
Contributor

@poorbarcode poorbarcode commented Dec 12, 2024

Motivation

Background
The steps for checking backlog metadata are as follows

  • Get the oldest cursor
  • Return the result if the oldest cursor.md equals LAC
  • Else, calculate the estimated backlog quota

Issue

  • The method PersistentTopic.estimatedTimeBasedBacklogQuotaCheck may get an NPE when the @param position(cursor.markDeletedPositon) equals LAC and the latest ledger has been removed by a ML.trimLedgers, which was introduced by [feat][broker] Implementation of PIP-323: Complete Backlog Quota Telemetry #21816
  • Q: The broker checked whether the oldest cursor.md equals LAC at step 2 above, why does it still call PersistentTopic.estimatedTimeBasedBacklogQuotaCheck with a param that equals LAC?
    • A: There may be some acknowledgments and ML.trimLedgers that happened between step2 above and step 3 above

Modifications

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: x

@poorbarcode poorbarcode added type/bug The PR fixed a bug or issue reported a bug release/3.0.9 release/3.3.4 release/4.0.2 labels Dec 12, 2024
@poorbarcode poorbarcode added this to the 4.1.0 milestone Dec 12, 2024
@poorbarcode poorbarcode self-assigned this Dec 12, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 12, 2024
@poorbarcode
Copy link
Contributor Author

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.43%. Comparing base (bbc6224) to head (a6ce58a).
Report is 788 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23720      +/-   ##
============================================
+ Coverage     73.57%   74.43%   +0.85%     
- Complexity    32624    35110    +2486     
============================================
  Files          1877     1945      +68     
  Lines        139502   147482    +7980     
  Branches      15299    16278     +979     
============================================
+ Hits         102638   109775    +7137     
- Misses        28908    29244     +336     
- Partials       7956     8463     +507     
Flag Coverage Δ
inttests 27.29% <0.00%> (+2.71%) ⬆️
systests 24.33% <0.00%> (+0.01%) ⬆️
unittests 73.82% <100.00%> (+0.97%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...sar/broker/service/persistent/PersistentTopic.java 80.02% <100.00%> (+1.56%) ⬆️

... and 667 files with indirect coverage changes

@poorbarcode poorbarcode merged commit 8e80f88 into apache:master Dec 13, 2024
52 checks passed
@liamgib
Copy link

liamgib commented Dec 16, 2024

Hi there, when will this fix be included in the next release?

@lhotari
Copy link
Member

lhotari commented Dec 16, 2024

@poorbarcode Would you mind cherry-picking this to branch-3.0 and branch-3.3? Thanks

poorbarcode added a commit that referenced this pull request Dec 17, 2024
@poorbarcode
Copy link
Contributor Author

@poorbarcode Would you mind cherry-picking this to branch-3.0 and branch-3.3? Thanks

Done

nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 19, 2024
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants