Skip to content

[fix][broker] Fix getPositionAfterN infinite loop. - #17971

Merged
Technoboy- merged 5 commits into
apache:masterfrom
Technoboy-:refactor-getPositionAfterN
Oct 13, 2022
Merged

[fix][broker] Fix getPositionAfterN infinite loop.#17971
Technoboy- merged 5 commits into
apache:masterfrom
Technoboy-:refactor-getPositionAfterN

Conversation

@Technoboy-

Copy link
Copy Markdown
Contributor

Fixes #17967

Master Issue: #17967

Motivation

The root cause is here(line-3365) :

Long lid = ledgers.ceilingKey(currentLedgerId + 1);
currentLedgerId = lid != null ? lid : (ledgers.lastKey() + 1);
currentEntryId = 0;

The currentLedgerId should be :

currentLedgerId = lid != null ? lid : (ledgers.lastKey());

Documentation

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

Matching PR in forked repository

PR in forked repository: https://github.com/Technoboy-/pulsar/pull/9

@codelipenghui codelipenghui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

Is it able to add an unit test?

@Technoboy-

Copy link
Copy Markdown
Contributor Author

Great catch!

Is it able to add an unit test?

We already have the test testGetPositionAfterN

@codelipenghui

codelipenghui commented Oct 10, 2022

Copy link
Copy Markdown
Contributor

We already have the test testGetPositionAfterN

@Technoboy- So why did the test get passed before? I think the test can't cover the case that introduces the infinite loop?

@Technoboy-

Copy link
Copy Markdown
Contributor Author

We already have the test testGetPositionAfterN

@Technoboy- So why did the test get passed before? I think the test can't cover the case that introduces the infinite loop?

Ah, yes, right. Sorry for this. I have added the test.

@Technoboy- Technoboy- changed the title [fix][ML] Fix getPositionAfterN infinite loop. [fix][broker] Fix getPositionAfterN infinite loop. Oct 11, 2022
@codelipenghui

Copy link
Copy Markdown
Contributor

@Technoboy- Please check the failed test

@Technoboy-
Technoboy- force-pushed the refactor-getPositionAfterN branch from 03ef4e9 to 9a44a73 Compare October 12, 2022 06:59
@Technoboy-

Copy link
Copy Markdown
Contributor Author

@Technoboy- Please check the failed test

Yes, I have fixed by #17993

@codecov-commenter

codecov-commenter commented Oct 12, 2022

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 45.78%. Comparing base (6c65ca0) to head (bac6889).
⚠️ Report is 3530 commits behind head on master.

Files with missing lines Patch % Lines
...che/bookkeeper/mledger/impl/ManagedLedgerImpl.java 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #17971       +/-   ##
=============================================
+ Coverage     34.91%   45.78%   +10.87%     
- Complexity     5707    17561    +11854     
=============================================
  Files           607     1573      +966     
  Lines         53396   128213    +74817     
  Branches       5712    14100     +8388     
=============================================
+ Hits          18644    58708    +40064     
- Misses        32119    63406    +31287     
- Partials       2633     6099     +3466     
Flag Coverage Δ
unittests 45.78% <80.00%> (+10.87%) ⬆️

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

Files with missing lines Coverage Δ
...che/bookkeeper/mledger/impl/ManagedLedgerImpl.java 71.29% <80.00%> (ø)

... and 1116 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Jason918 Jason918 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Technoboy-
Technoboy- force-pushed the refactor-getPositionAfterN branch from 84f4711 to bac6889 Compare October 13, 2022 05:18
@Technoboy-
Technoboy- merged commit c732852 into apache:master Oct 13, 2022
@Technoboy- Technoboy- modified the milestones: 2.12.0, 2.11.0 Oct 13, 2022
congbobo184 pushed a commit that referenced this pull request Nov 8, 2022
@congbobo184 congbobo184 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Nov 8, 2022
congbobo184 pushed a commit that referenced this pull request Nov 26, 2022
liangyepianzhou pushed a commit that referenced this pull request Dec 7, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 10, 2023
(cherry picked from commit c732852)
(cherry picked from commit 49a3a13)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 11, 2023
(cherry picked from commit c732852)
(cherry picked from commit 49a3a13)
@Technoboy-
Technoboy- deleted the refactor-getPositionAfterN branch November 11, 2023 07:27
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.

[BUG]Unknown reason causes getPositionAfterN infinite loop

8 participants