Skip to content

Antalya 26.8 Backport of #127100 - Read Iceberg manifest files on the IO thread pool and remove the manifest decode pool - #2967

Open
blau-ai wants to merge 3 commits into
antalya-26.8from
backports/antalya-26.8/127100
Open

blau-ai wants to merge 3 commits into
antalya-26.8from
backports/antalya-26.8/127100

Conversation

@blau-ai

@blau-ai blau-ai commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Iceberg manifest files are now read ahead on the IO thread pool, up to 64 at a time, and parsed by the threads that read the table, so a query over a table with many manifests on object storage overlaps more round trips (3.2x faster on 200 manifests with 400 ms per read). The thread pool for decoding manifests is removed, and the settings iceberg_manifest_decode_concurrency (and its old name iceberg_delete_manifest_decode_concurrency), iceberg_file_entries_queue_size, max_iceberg_manifest_decode_thread_pool_size, max_iceberg_manifest_decode_thread_pool_free_size and iceberg_manifest_decode_thread_pool_queue_size are obsolete and have no effect. (ClickHouse#127100 by @groeneai)

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

…ests-on-io-pool

Read Iceberg manifest files on the IO thread pool and remove the manifest decode pool

Conflicts committed as-is, conflict markers included:
- programs/local/LocalServer.cpp (both modified)
- programs/server/Server.cpp (both modified)
- src/Client/BuzzHouse/Generator/SessionSettings.cpp (both modified)
- src/Core/ServerSettings.cpp (both modified)
- src/Core/Settings.cpp (both modified)
- src/IO/SharedThreadPools.h (both modified)
- src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergIterator.cpp (both modified)
- src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergIterator.h (both modified)
- src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.cpp (both modified)
- src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFile.cpp (both modified)
- src/Storages/ObjectStorage/DataLakes/Iceberg/StatelessMetadataFileGetter.cpp (both modified)
- tests/integration/test_storage_iceberg_with_spark/test_data_manifest_decode_concurrency.py (both modified)
- tests/performance/iceberg_scale_manifests.xml (missing on the branch, changed by the port)
- tests/performance/iceberg_suite_shared_rw_features.xml.inc (missing on the branch, changed by the port)
@blau-ai

blau-ai commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Port-AL: this PR has unresolved cherry-pick conflicts

AI could not resolve them (review failed: AI did not report an outcome), so the cherry-pick is committed as-is (6630095), conflict markers included, in:

  • programs/local/LocalServer.cpp (both modified)
  • programs/server/Server.cpp (both modified)
  • src/Client/BuzzHouse/Generator/SessionSettings.cpp (both modified)
  • src/Core/ServerSettings.cpp (both modified)
  • src/Core/Settings.cpp (both modified)
  • src/IO/SharedThreadPools.h (both modified)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergIterator.cpp (both modified)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergIterator.h (both modified)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.cpp (both modified)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/ManifestFile.cpp (both modified)
  • src/Storages/ObjectStorage/DataLakes/Iceberg/StatelessMetadataFileGetter.cpp (both modified)
  • tests/integration/test_storage_iceberg_with_spark/test_data_manifest_decode_concurrency.py (both modified)
  • tests/performance/iceberg_scale_manifests.xml (missing on the branch, changed by the port)
  • tests/performance/iceberg_suite_shared_rw_features.xml.inc (missing on the branch, changed by the port)

Resolve them on this branch, then mark the PR ready for review.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [6290898]

@zvonand

zvonand commented Nov 26, 2026

Copy link
Copy Markdown
Member

@blau-ai fix fasttest

The cherry-pick committed conflict markers, breaking the build. Resolve them:
keep the branch's CAS blob upload pool, ParquetEncoder pool, external storage
resolution, deletion vector handling and totalRows; take upstream's manifest
read-ahead on the IO pool; pass the external storage cache to the prefetcher;
declare the removed settings obsolete in the branch's MAKE_OBSOLETE format;
drop estimateRead and profile events that do not exist on this branch, and
the two performance tests that were never on the branch.
@blau-ai

blau-ai commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Fast test: fixed the build (conflict markers were committed)

Root cause: Fast test failed at Build ClickHouse:

src/IO/SharedThreadPools.h:74:1: error: version control conflict marker in file

The cherry-pick of ClickHouse#127100 committed <<<<<<</>>>>>>> markers in 12 files (24 hunks). This was not a test failure: nothing compiled.

Fix: pushed fd74cab to backports/antalya-26.8/127100. It resolves every hunk:

Area Resolution
Server.cpp, LocalServer.cpp, SharedThreadPools.h, ServerSettings.cpp Removed the manifest-decode pool as upstream does. Kept the branch's CAS blob-upload pool and ParquetEncoder pool. The 3 pool server settings are now OBSOLETE, which matches the cherry-picked 02888_obsolete_settings.reference.
Settings.cpp Removed iceberg_manifest_decode_concurrency (and its alias) and iceberg_file_entries_queue_size from the active settings. They are now MAKE_OBSOLETE in the branch's format, which has no inline history. Upstream's iceberg_list_only_v_prefixed_metadata_files is not brought in.
IcebergIterator.{h,cpp} Took upstream's new design (ManifestFilesPrefetcher + nextDataFileEntry, pruner built in the constructor) and dropped DataFileEntriesStream. Kept everything specific to the branch: external_storages, table_schema_id, the deletion-vector / parquet-position-delete split (also applied in ensureDeletesReady), the next() body with DataFileMetaInfo and the cluster path checks, and estimatedKeysCount.
StatelessMetadataFileGetter.{h,cpp} getManifestFile keeps the branch's resolveObjectStorageForPath and uses upstream's read-bytes-then-parse-lazily approach. New: ManifestFilesPrefetcher takes a shared_ptr<ExternalStorageCache> and passes it to the read tasks, so manifests on external storages still resolve.
IcebergMetadata.cpp Kept the branch's version: upstream's estimateRead doesn't exist here, and the branch's totalRows has its own access checks and overflow guards. totalRows/totalBytes still read manifests one after another, as before this PR; they don't use the read-ahead.
ManifestFile.cpp, getter Dropped the IcebergManifestFilesReadBytes / IcebergManifestFilesReadMicroseconds profile events, which don't exist on this branch.
BuzzHouse SessionSettings.cpp Kept the branch's lists.
test_data_manifest_decode_concurrency.py Kept the branch's removal of the row-lineage test.
tests/performance/iceberg_scale_manifests.xml, iceberg_suite_shared_rw_features.xml.inc Removed. They never existed on this branch, and the cherry-pick had added them whole.

Validation: I committed the change and started a Debug build of fd74cab on the blau builder (--reason "Compile conflict resolution of backport #127100 (Iceberg manifest read-ahead) for PR 2967 fast test"). It was still compiling when I pushed, and I stopped waiting because this job's budget was running out. This commit has not been validated locally. I pushed anyway because the branch didn't compile at all before it. Fast test and the rest of CI on this PR will be the first to check it.

Still to do by a human:

  • Watch CI for compile errors. The places most likely to need a follow-up are the IcebergIterator / StatelessMetadataFileGetter merges.
  • Once it builds, check the Iceberg stateless tests: 05441_iceberg_more_manifests_than_read_ahead, 04261/04262_iceberg_deletion_vector*, 04291_..._position_deletes_multi_file, 04267_iceberg_parquet_in_subquery. Also check the Iceberg integration tests, especially the ones using external storages.
  • DCO is also red. It's a sign-off check on the commits, not code.

@zvonand

zvonand commented Dec 3, 2026

Copy link
Copy Markdown
Member

@blau-ai

@zvonand
zvonand marked this pull request as ready for review December 3, 2026 11:52
@blau-ai

blau-ai commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

CI triage for fd74cabf: 3 failing checks. 1 is likely PR-caused, 2 are pre-existing (Grype). DCO is pending.

Check Classification PR-caused? Next step
RegressionTestsRelease / Swarms / swarms (x86_64), scenario object storage cluster profile events with overloaded node Iceberg cluster task-distribution regression Likely yes (medium confidence) Re-run the job. If it fails again, look at how the initiator's iterator feeds StableTaskDistributor (see below)
GrypeScanServer (-alpine) / Grype Scan CVE scan of the base image No (high) None. The same check fails on base 0f2d3abefe
GrypeScanKeeper / Grype Scan CVE scan of the base image No (high) None. The same check fails on base 0f2d3abefe
DCO action_required n/a Sign-off or DCO override needed before merge

All other checks are green. These results come from a single CI run (2026-11-26). The base branch has moved since then, and a rebase or merge would also pick up its Grype fixes.

Swarms / swarms: likely PR-caused (medium confidence)

Only one scenario fails (job log):

✘ [ Fail ] '/swarms/feature/feature/object storage cluster profile events with overloaded node' (16s 982ms)
  File ".../swarms/tests/object_storage_cluster_profile_events.py", line 215
    assert int(sent_to_non_matched_replica) > 0, error()
               ^ is '0'

What the test does: it creates an Iceberg table with 4 large files (500k rows each), followed by 100 small files. It then queries the table through the swarm cluster with max_threads=1 and lock_object_storage_task_distribution_ms=2. Because the replicas that own the large files are busy, it expects some small files to be stolen by other replicas, so ObjectStorageClusterSentToNonMatchedReplica should be greater than 0. In this run it was 0. The row count assertion passed, so the result is correct; only the work distribution changed.

Why I think the PR is responsible:

  • The scenario passes on the base branch. RegressionTestsRelease / Swarms and RegressionTestsAarch64 / Swarms are green on base 199f1b4bc8, a0530ca971 and 0f2d3abefe. It also passes on sibling 26.8 PRs Keep Iceberg annotations of struct, list and map fields made optional #2986 and Antalya 26.8: Resolve currentDatabase() in Hybrid segment metadata #2972.
  • The PR rewrites exactly the code this test depends on: how IcebergIterator produces data files. Before, a producer thread and a decode pool filled a queue ahead of the consumer. Now manifests are only prefetched as bytes, and the thread that calls next() parses them. The upstream description of Read Iceberg manifest files on the IO thread pool and remove the manifest decode pool ClickHouse/ClickHouse#127100 calls this out: "max_threads = 1, cold: 0.118 s / 0.469 s (parsing is serial on one reading thread; the initiator of the *Cluster table functions also reads the iterator from one thread)".
  • On the initiator, StorageObjectStorageStableTaskDistributor::getMatchingFileFromIterator calls iterator->next(0) under the distributor lock. Stealing (getAnyUnprocessedFile) only happens for files already in unprocessed_files whose owner has been inactive for longer than lock_object_storage_task_distribution_ms. If files now come out of the iterator more slowly or in a different rhythm, the owning replicas can collect all their files before the 2 ms deferral expires, so nothing is stolen.

Caveat: this is a single run of a timing-sensitive scenario, and I could not reproduce it locally (the builder runs stateless and unit tests, not the multi-node swarms regression suite). That is why the confidence is medium rather than high.

Suggested next steps:

  1. Re-run the failed Swarms job (and the aarch64 one, if it gets scheduled). If it is green twice, treat this as flaky timing.
  2. If it fails again: on the initiator, measure how long IcebergIterator::next takes per file when 104 files are spread over a few manifests. If the small files from the last manifests show up only after the large-file replicas have finished, either:
    • prefetch-parse the data manifests on the initiator for the *Cluster path, so the distributor sees files as fast as before the PR, or
    • accept the new behaviour and adjust the regression test in Altinity/clickhouse-regression (for example, a larger lock_object_storage_task_distribution_ms or more small files), stating why in this PR.
Grype Scan (server-alpine, keeper): pre-existing, not PR-caused

These checks scan the published Docker images for CVEs in OS packages. The PR does not touch Docker files or dependencies; it only changes Iceberg code, settings and tests. The same two scans (GrypeScanServer (-alpine) and GrypeScanKeeper) fail on base commit 0f2d3abefe (MasterCI 2026-11-27), while the non-alpine server scan passes there, which is exactly the pattern seen here. They are green on newer base commits (a0530ca971, 199f1b4bc8), so syncing with antalya-26.8 should clear them. No action is needed on the PR's code.

This branch has not been deployed

No deployments
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.

3 participants