disagg: honor pager early-stop on truncated list#10762
disagg: honor pager early-stop on truncated list#10762ti-chi-bot[bot] merged 3 commits intopingcap:masterfrom
Conversation
Treat pager more=false as an explicit termination condition for listPrefix/listPrefixWithDelimiter so truncated listings do not re-fetch the same page indefinitely. Add a regression test that stops on the first key in a multi-page prefix and verifies the listing exits immediately.
|
Review Complete Findings: 3 issues ℹ️ Learn more details on Pantheon AI. |
📝 WalkthroughWalkthroughFixes S3 listing pagination so an early-stop callback immediately exits the outer pagination loop on truncated results; also adjusts continuation-token handling and updates MockS3Client pagination behavior. Adds tests verifying early termination for both objects and delimited prefixes. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant S3Common
participant S3Service
Caller->>S3Common: listPrefix(req, pager)
loop while not done
S3Common->>S3Service: ListObjectsV2(request)
S3Service-->>S3Common: page(result, IsTruncated, NextContinuationToken)
alt process contents/prefixes
S3Common->>Caller: pager(item) -- returns PageResult.more
Caller-->>S3Common: PageResult{more=true/false}
end
alt pager returned more=false
S3Common-->>S3Common: should_continue = false
S3Common-->>S3Common: break outer loop (stop listing)
else pager returned more=true and IsTruncated
S3Common-->>S3Common: set continuation token and continue
end
end
S3Common-->>Caller: return
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: JaySon-Huang <tshent@qq.com>
Add MockS3 ListObjectsV2 pagination support so regression tests exercise truncated listings under the default unit-test setup. Tighten the early-stop tests with explicit truncation prechecks, symmetric delimiter coverage, and test-local cleanup while keeping the production listPrefix APIs unchanged.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
dbms/src/Storages/S3/MockS3Client.cpp (1)
198-213: Variable naming uses snake_case rather than camelCase.The coding guidelines specify camelCase for C++ variables and methods (
maxKeys,continuationToken,finalizePage). However, the existing code in this file already uses snake_case (bucket_storage,itr_obj,normalized_prefix), so these additions are consistent with the current file style.Consider aligning with the guidelines in future refactoring efforts, or updating the file's style consistently.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dbms/src/Storages/S3/MockS3Client.cpp` around lines 198 - 213, The new local variables use snake_case contrary to project guidelines—rename constexpr default_max_keys to defaultMaxKeys and the locals max_keys and continuation_token to maxKeys and continuationToken respectively (also update any subsequent uses in the ListObjectsV2 handling code and checks that reference request.GetMaxKeys(), request.GetContinuationToken(), and the RUNTIME_CHECK calls) so the new variables follow camelCase like other symbols in this file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@dbms/src/Storages/S3/MockS3Client.cpp`:
- Around line 198-213: The new local variables use snake_case contrary to
project guidelines—rename constexpr default_max_keys to defaultMaxKeys and the
locals max_keys and continuation_token to maxKeys and continuationToken
respectively (also update any subsequent uses in the ListObjectsV2 handling code
and checks that reference request.GetMaxKeys(), request.GetContinuationToken(),
and the RUNTIME_CHECK calls) so the new variables follow camelCase like other
symbols in this file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 46cf9ce9-6a5d-4c6e-a1c6-61a06ff5178e
📒 Files selected for processing (2)
dbms/src/Storages/S3/MockS3Client.cppdbms/src/Storages/S3/tests/gtest_s3client.cpp
✅ Files skipped from review due to trivial changes (1)
- dbms/src/Storages/S3/tests/gtest_s3client.cpp
|
Second-opinion review completed for The updated branch now covers the truncated pagination path in both |
[LGTM Timeline notifier]Timeline:
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CalvinNeo, JinheLin, Lloyd-Pottiger The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick release-nextgen-20251011 |
|
@JaySon-Huang: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
close #10761 fix(s3): honor pager early-stop on truncated list Treat pager `more=false` as an explicit termination condition for both `listPrefix` and `listPrefixWithDelimiter`, so truncated listings do not re-fetch the same page indefinitely. Add a regression unit test that creates a multi-page prefix and requests early stop on the first callback; verify listing exits immediately. Signed-off-by: JaySon-Huang <tshent@qq.com> Co-authored-by: JaySon-Huang <tshent@qq.com>
What problem does this PR solve?
Issue Number: close #10761
Problem Summary:
When
S3::listPrefix(andlistPrefixWithDelimiter) callback returnsPageResult{.more=false}on a truncated page, the code only breaks the inner object loop. The outer pagination loop may continue without advancing continuation token, repeatedly listing the same page and potentially blocking shutdown paths that wait for background tasks to exit.What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Summary by CodeRabbit
Bug Fixes
Tests