Skip to content

Prefetch next manifest during current manifest parse - #108543

Merged
asya-ch merged 9 commits into
masterfrom
asya/prefetch_manifest
Jul 28, 2026
Merged

asya-ch merged 9 commits into
masterfrom
asya/prefetch_manifest

Conversation

@asya-ch

@asya-ch asya-ch commented Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a [user-readable short description]):

Speed up reading of Iceberg tables by prefetching the next manifest file while the current manifest is being parsed, overlapping I/O with CPU work.

Version info

  • Merged into: 26.8.1.286 (included in 26.8 and later)

@clickhouse-gh

clickhouse-gh Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [dd51228]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) FAIL
Server died FAIL cidb IGNORED
Logical error: Got read request from replica A for unknown stream B. (STID: 5217-5b3d) FAIL cidb, issue ISSUE EXISTS

AI Review

Summary

This PR adds one-manifest-ahead prefetching to the Iceberg manifest iterator so manifest I/O can overlap with processing of the current manifest, and backs it with a failpoint-driven integration test. I rechecked the latest code and prior discussion, including the future-lifetime throw paths and the strengthened timing assertion, and I did not find a remaining correctness, compatibility, or evidence issue that should block the change.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-performance Pull request with some performance improvements label Jun 25, 2026

logging.info("SELECT * over %s manifests took %.3f seconds", NUMBER_OF_MANIFESTS, duration)

assert duration < MAX_SELECT_SECONDS, (

@asya-ch asya-ch Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly a sanity check and tool for future use. I've noticed it takes ~30% less time (0.6 -> 0.42 seconds), although real-worlds diffs will depend on how large the manifest files are.

@clickhouse-gh

clickhouse-gh Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 37 queries analysed

This change is confined to Iceberg manifest-file prefetching in the object-storage data-lake iterator (plus a test-only failpoint and integration test); ClickBench queries run on a native table and never touch that code path. The two flagged deltas on Q4 (-22.0%) and Q15 (-14.3%) are improvements that fall inside master's normal variance band, and CPU time is essentially unchanged on both, so there is no work-backed effect. The deterministic no_change verdicts are correct and consistent with the diff. No real per-query performance impact from this PR.

clickbench

🟢 No significant changes

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 79ada1cd-80a2-4b4d-a11d-5a8bbcd3b5c1
  • MIRAI run: 284cea56-fcec-4f2a-b05b-5270531fe1a7
  • PR check IDs:
    • clickbench_611866_1785207761
    • clickbench_611872_1785207761
    • clickbench_611886_1785207761
    • tpch_adapted_1_official_611896_1785207761
    • tpch_adapted_1_official_611908_1785207761
    • tpch_adapted_1_official_611934_1785207761

@SmitaRKulkarni SmitaRKulkarni self-assigned this Jun 29, 2026

@SmitaRKulkarni SmitaRKulkarni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest all LGTM


logging.info("SELECT * over %s manifests took %.3f seconds", NUMBER_OF_MANIFESTS, duration)

assert duration < MAX_SELECT_SECONDS, (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this check. If the failpoint is enabled, retrieving a single manifest takes about 100 ms. Consequently, sequential reading will take approximately 100 ms * NUMBER_OF_MANIFESTS, which is significantly less than 60 seconds.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant it as a sanity check -- was trying to be cautious in case things were slower in CI for whatever reason. I'll try setting it to 0.6 seconds and see if it holds up.


void SingleThreadIcebergKeysIterator::schedulePrefetchIfPossible()
{
if (!data_snapshot || prefetched_manifest.has_value())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right that we can prefetch only next manifest? If so, I think we can improve it via creating cache for N manifests

@asya-ch asya-ch Jul 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it could be nice to have a small, tunable deque of prefetched_manifests. For the sake of simplicity, I won't include it in this PR, but we could add it as a future optimization.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to have multiple concurrent producer threads.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok as you wish

@clickhouse-gh

clickhouse-gh Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.20% 86.20% +0.00%
Functions 92.00% 91.90% -0.10%
Branches 78.40% 78.20% -0.20%

Changed lines: Changed C/C++ lines covered: 58/59 (98.31%) · Uncovered code

Full report · Diff report

@asya-ch
asya-ch added this pull request to the merge queue Jul 28, 2026
Merged via the queue into master with commit dff5de2 Jul 28, 2026
176 of 178 checks passed
@asya-ch
asya-ch deleted the asya/prefetch_manifest branch July 28, 2026 15:34
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 28, 2026
@asya-ch

asya-ch commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

Closes issue #105049.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-performance Pull request with some performance improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants