Repository navigation
Parallelize delete manifests reads - #112679
Conversation
|
Workflow [PR], commit [b4b3061] Summary: ✅
AI ReviewSummaryThis PR lazily parallelizes Iceberg delete-manifest decoding so data-manifest prefetch can overlap with delete processing, and it adds a new Findings
Final VerdictStatus: Minimum required actions:
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 115/121 (95.04%) · Uncovered code |
| return | ||
|
|
||
| # Verify failpoint fired. | ||
| serial_floor = 0.8 * DELETE_COUNT * SLEEP_PER_MANIFEST_SECONDS |
There was a problem hiding this comment.
Perhaps it would be better to add such checks to the performance tests?
There was a problem hiding this comment.
Perf tests unfortunately can't cover it because that environment has no Spark, minio/s3 disks, or Iceberg tests.
I think it would be nice to eventually add it so that these improvements are more measurable, but this is probably not the place.
There was a problem hiding this comment.
has no Spark, minio/s3 disks
I think we can use IcebergLocal
There was a problem hiding this comment.
Good point, I'll add it.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 114/119 (95.80%) · Uncovered code |
|
I opened a fix for the flake in CI here: #113398. |
There was a problem hiding this comment.
Pull request overview
This PR parallelizes decoding of Iceberg delete manifest files so multiple object-storage reads and pruning work can overlap before reading data files, controlled by a new iceberg_delete_manifest_decode_concurrency setting (default 4). It also adds an integration test to validate correctness across different concurrency values and to assert that decoding is actually concurrent under a latency-injection failpoint.
Changes:
- Parallelize delete-manifest decoding in
IcebergIteratorusing bounded concurrency with the IO thread pool. - Add the
iceberg_delete_manifest_decode_concurrencysetting and register it in settings history for compatibility. - Add an integration test covering correctness and concurrency/timing behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/test_storage_iceberg_with_spark/test_delete_manifest_decode_concurrency.py | Adds correctness + timing-based concurrency coverage for delete manifest decoding using iceberg_slow_manifest_read. |
| src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergIterator.h | Adds delete-manifest lazy init/decode helpers and synchronization state for one-time initialization. |
| src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergIterator.cpp | Implements bounded parallel decode of delete manifests and defers decoding to next via ensureDeletesReady. |
| src/Core/SettingsChangesHistory.cpp | Records the new setting for compatibility behavior across versions. |
| src/Core/Settings.cpp | Documents and defines the new iceberg_delete_manifest_decode_concurrency setting (default 4). |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
| <create_query>CREATE TABLE perf_iceberg_delete_manifests (id Int64, data String) ENGINE = IcebergLocal(concat(getServerSetting('user_files_path'), '/perf_iceberg_delete_manifests/'))</create_query> | ||
| <create_query>INSERT INTO perf_iceberg_delete_manifests SELECT number, toString(number) FROM numbers(100000) SETTINGS allow_insert_into_iceberg = 1</create_query> | ||
| <create_query>ALTER TABLE perf_iceberg_delete_manifests DELETE WHERE id = {n} SETTINGS allow_insert_into_iceberg = 1</create_query> | ||
|
|
||
| <query>SELECT max(id) FROM perf_iceberg_delete_manifests SETTINGS use_iceberg_metadata_files_cache = 0</query> |
There was a problem hiding this comment.
The Performance Improvement claim here is specifically about overlapping object-storage round-trips, but this benchmark only runs IcebergLocal and never injects manifest-read latency. It can stay green even if the remote fetch path becomes accidentally serialized again, because it is only measuring local decode CPU.
Please keep a focused timing check that exercises getManifestFile latency as well, for example by enabling iceberg_slow_manifest_read on a remote-backed Iceberg read path, in addition to this local benchmark.
There was a problem hiding this comment.
I think it is fine as-is. Perf tests don't support failpoints and must run pretty quickly, so it's more difficult than it's worth to simulate download latency in the perf test. This test does show ~20% improvement, so I think it is good enough as a heuristic.
|
📊 Cloud Performance Report 🟢 AI verdict: This PR only changes Iceberg delete-manifest decoding (making delete manifests decode concurrently) plus a new iceberg_delete_manifest_decode_concurrency setting. None of the flagged ClickBench or TPC-H queries read Iceberg tables, so they execute none of the changed code. The consistently one-directional improvements are off-path and were downgraded to not_sure where possible; clickbench Q23 (x2.3 faster), tpch Q7 (x8.4 faster) and Q8 (x2.1 faster) are locked by their large deltas but likewise don't correspond to the change, so treat them as build/measurement variance. The two envelope-suppressed rows (clickbench Q12 and Q31) correctly read as no_change and are consistent with this being an Iceberg-only change. clickbench🟢 1 improved · Flagged queries (7 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 2 improved Flagged queries (2 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
| }); | ||
| } | ||
|
|
||
| void IcebergIterator::ensureDeletesReady() |
There was a problem hiding this comment.
why do we need this lazy decoding? maybe it's better to start it in the constructor?
There was a problem hiding this comment.
The main reason is that you don't need to wait for deletes to be processed to kick off the producer thread that downloads data files, so you get extra overlap.
(I'll add a comment to make it more clear.)
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes5 object files changed (+50.78 KiB total), 0 added.
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units31 translation units recompiled, 331 s compile time in total, 31 of them have a recent master baseline. |
| } | ||
| catch (...) | ||
| { | ||
| deletes_exception = std::current_exception(); |
There was a problem hiding this comment.
producer_task already starts in the constructor, before any delete manifest is decoded. If decodeDeleteManifests() throws here (bad delete manifest, transient object-store error, etc.), we store the exception but never stop the background data-manifest producer, so this shared iterator can keep prefetching/parsing data manifests until every source tears it down. Before this change the same failure aborted construction before that work existed.
Can we signal cancellation on this path as well (for example blocking_queue.finish() plus any extra producer stop you need) so a fatal delete-manifest error stops the background work immediately?
|
Closes #105044 |
Reading an Iceberg snapshot's data files walked the data manifests one at a time in the producer thread: the one-ahead prefetch overlapped the next manifest's fetch with the current parse, but the decode itself - the Avro parse plus per-entry partition and min-max pruning - stayed serial. On tables with many manifest files this dominates the time before all data files are known. Follow up ClickHouse#112679, which introduced a bounded sliding window of decode tasks on the IO pool for delete manifests, by decoding data manifests through the same pattern: each task owns the full pipeline for one manifest (fetch, deserialize, prune), futures are consumed in manifest list order, and entries stream into the existing bounded queue, whose blocking `push` bounds read-ahead. The per-manifest decode body is shared between the delete and data paths (`decodeManifest`), and `SingleThreadIcebergKeysIterator` with its one-manifest prefetch is removed: a window of size 2 gives the closest equivalent of the previous overlap, and 1 decodes the manifests one at a time. The new setting `iceberg_data_manifest_decode_concurrency` (default 4) bounds the window, mirroring `iceberg_delete_manifest_decode_concurrency`.
Changelog category (leave one):
Changelog entry:
Queries on Iceberg tables with many delete files now start faster. ClickHouse reads and decodes the delete manifest files concurrently instead of one at a time, so their storage reads overlap. The new setting
iceberg_delete_manifest_decode_concurrency(default4) controls how many are decoded at the same time.Workflow [PR]
Sync PR [sync-upstream/pr/112679]
Version info
26.8.1.1784(included in26.8and later)