Skip to content

Fix invalid range error when getting number of entries - #2709

Merged
sijie merged 1 commit into
apache:masterfrom
massakam:invalid-range-error
Oct 4, 2018
Merged

Fix invalid range error when getting number of entries#2709
sijie merged 1 commit into
apache:masterfrom
massakam:invalid-range-error

Conversation

@massakam

@massakam massakam commented Oct 3, 2018

Copy link
Copy Markdown
Contributor

For a topic with metadata similar to #2673, IllegalArgumentException may occur in the following line:

return getNumberOfEntries(Range.closedOpen(readPosition, ledger.getLastPosition().getNext()));

This is the broker log when the exception has occurred:
invalid_range_error.txt

It is because readPosition is ahead of ledger.getLastPosition().getNext(), so ManagedCursorImpl#getNumberOfEntries() should return 0 as the number of entries to read in that case.

I think this issue and #2673 are the result of that ledger.getLastPosition() is no longer the real last of the managed ledger because of #1550.

@massakam massakam added this to the 2.3.0 milestone Oct 3, 2018
@massakam massakam self-assigned this Oct 3, 2018

@merlimat merlimat 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.

👍

@nkurihar

nkurihar commented Oct 3, 2018

Copy link
Copy Markdown
Contributor

rerun cpp tests

@nkurihar

nkurihar commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

rerun integration tests

@sijie
sijie merged commit 12962d0 into apache:master Oct 4, 2018
@massakam
massakam deleted the invalid-range-error branch October 4, 2018 01:35
@massakam massakam modified the milestones: 2.3.0, 2.2.1 Oct 29, 2018
@merlimat merlimat modified the milestones: 2.2.1, 2.2.0 Dec 13, 2018
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.

4 participants