[fix](http) Handle metadata pagination boundaries - #67816
Open
morrySnow wants to merge 1 commit into
Open
Conversation
### What problem does this PR solve? Problem Summary: Metadata REST endpoints could return the last item for an offset beyond the list, overflow when adding large limit and offset values, or expose numeric parsing failures as internal errors. This change makes the legacy and v2 endpoints share an overflow-safe pagination helper. It parses non-negative long values, returns an empty range when the offset is at or beyond the list end, bounds the page by the remaining item count without unsafe addition, and reports invalid values as bad requests. Unit and HTTP regression tests cover normal, out-of-range, overflow, and malformed inputs. ### Release note Fix metadata REST pagination for large and invalid limit or offset values. ### Check List (For Author) - Test: Unit Test and Regression Test - Behavior changed: Yes. Out-of-range offsets now return an empty page, and invalid pagination values return a stable bad-request response. - Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
TPC-H: Total hot run time: 16728 ms |
Contributor
TPC-DS: Total hot run time: 81470 ms |
Contributor
ClickBench: Total hot run time: 14.65 s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Metadata REST endpoints can mishandle large pagination values in three ways:
The behavior affects both the legacy metadata routes and the v2 metadata routes. It can be reproduced by requesting a metadata list with a very large offset, with both limit and offset set to the maximum integer, or with a pagination value larger than the supported numeric range.
What is the root cause?
Both controllers contain duplicate pagination logic based on int parsing and direct limit-plus-offset arithmetic. The lower bound is also capped at size minus one, which turns a past-the-end offset into the last element.
What changes are included?
Release note
Fix metadata REST pagination for large and invalid limit or offset values.
Check List (For Author)