Repository navigation
Fix S3 listObjects dropping objects on an empty page with a continuation token - #118615
Merged
Merged
Conversation
…ion token S3ObjectStorage::listObjects stopped paginating as soon as a response carried no keys, ignoring IsTruncated. A listing may legitimately return an empty page while more keys remain, in which case every object after that page was silently lost. The most exposed caller is IObjectStorage::existsOrHasAnyChild, which lists with max-keys=1, so a single such response makes it report that a path does not exist. That is how MetadataStorageFromPlainRewritableObjectStorage::load decides whether the disk holds anything: the disk then comes up with no directories at all and a MergeTree table on it loses every part it has. The same listing also backs directory lookups on plain disks and data lake metadata discovery for Iceberg, Delta Lake, Hudi and Paimon. IObjectStorageIteratorAsync::nextBatch had the same defect and was fixed separately; this is the remaining copy.
Contributor
|
Workflow [PR], commit [22698c7] Summary: ❌
AI ReviewSummaryThis PR fixes the synchronous Final Verdict
LLVM Coverage ReportMeasured on commit 22698c7.
Changed lines: Changed C/C++ lines covered: 5/5 (100.00%) · Uncovered code |
kssenii
approved these changes
Sep 7, 2026
… part set The existing test stops at the disk coming up empty. This one carries it through to the damage that follows: with the parts hidden, the block counter restarts from 1, so parts written afterwards reuse block numbers already present on the disk. Each generation merges into a level 1 part with the same left edge, all_1_2_1 and all_1_3_1, and MergeTreePartInfo::contains rejects that pair because a containing part may only have an equal level when the block range is identical. Once both generations are listed the table cannot be attached at all. Without the fix the second startup fails with Part all_1_2_1 intersects next part all_1_3_1. It is a bug or a result of manual intervention: Cannot attach table `default`.`test_intersecting` The merges are what make this an intersection rather than a name collision: two generations of level 0 parts would simply reuse the same directory names.
1 task
This was referenced Sep 8, 2026
clickhouse-gh Bot
pushed a commit
that referenced
this pull request
Sep 8, 2026
…mpty page with a continuation token
clickhouse-gh Bot
added a commit
that referenced
this pull request
Sep 8, 2026
Backport #118615 to 26.8: Fix S3 listObjects dropping objects on an empty page with a continuation token
CheSema
added a commit
that referenced
this pull request
Sep 8, 2026
Backport #118615 to 26.7: Fix S3 listObjects dropping objects on an empty page with a continuation token
CheSema
added a commit
that referenced
this pull request
Sep 8, 2026
Backport #118615 to 26.6: Fix S3 listObjects dropping objects on an empty page with a continuation token
CheSema
added a commit
that referenced
this pull request
Sep 8, 2026
Backport #118615 to 26.3: Fix S3 listObjects dropping objects on an empty page with a continuation token
CheSema
added a commit
that referenced
this pull request
Sep 9, 2026
Reuses the mock #118615 left behind, which injects a listing answering with no keys, IsTruncated and a continuation token, so the case needs no new fixture. 3 passed in 48.65s.
This was referenced Sep 9, 2026
kewin-robetti
pushed a commit
to viasoftkorp/ClickHouse
that referenced
this pull request
Sep 11, 2026
…ts on an empty page with a continuation token
kewin-robetti
pushed a commit
to viasoftkorp/ClickHouse
that referenced
this pull request
Sep 11, 2026
…ts on an empty page with a continuation token
kewin-robetti
pushed a commit
to viasoftkorp/ClickHouse
that referenced
this pull request
Sep 11, 2026
…ts on an empty page with a continuation token
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.
Related: #109761
Related: #109751
S3ObjectStorage::listObjectsstopped paginating as soon as a response carried no keys, ignoringIsTruncated. A listing may legitimately return an empty page while more keys remain, and every object after that page was then silently lost.The most exposed caller is
IObjectStorage::existsOrHasAnyChild, which lists withmax-keys=1, so one such response makes it report that a path does not exist. That is howMetadataStorageFromPlainRewritableObjectStorage::loaddecides whether the disk holds anything, so the disk comes up with no directories at all and a MergeTree table on it loses every part. The same listing also backs directory lookups onplaindisks and data lake metadata discovery for Iceberg, Delta Lake, Hudi and Paimon, where dropping the tail can mean reading an older snapshot.IObjectStorageIteratorAsync::nextBatchhad the same defect and was fixed in #109761. That fix does not cover this path: on aplain_rewritabledisk theexistsOrHasAnyChildprobes run before the iterator is used and can short-circuit the whole load.Added
tests/integration/test_s3_list_objects_empty_page, which proxies MinIO and answers the first listing of each prefix with no keys plusIsTruncated=trueand a continuation token.test_empty_listing_page_does_not_hide_partscovers the immediate effect: without the fix the table reports 0 of 100 rows after a restart.test_empty_listing_page_does_not_create_intersecting_partscarries it through to the lasting damage. With the parts hidden the block counter restarts from 1, so the next generation of parts reuses block numbers already on the disk. Each generation merges into a level 1 part with the same left edge, and once both are listed the table cannot be attached at all:Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed object storage listing silently skipping objects when S3 returns an empty page together with a continuation token. This could make a
plain_rewritabledisk appear empty and hide table parts, and could make data lake tables read a stale snapshot.Documentation entry for user-facing changes
Version info
26.9.1.940(included in26.9and later)26.8.3.60,26.7.7.48,26.6.5.74,26.3.33.19