Skip to content

Make the 04780 index-analysis allocation oracle the minimum of several runs - #114608

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix/04780-min-of-runs-alloc-oracle
Aug 13, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix/04780-min-of-runs-alloc-oracle

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Related: #104948

04780_json_subcolumn_index_match_not_quadratic compares MemoryAllocatedWithoutCheckBytes of a dotted-constant EXPLAIN indexes = 1 against a no-dots control with a 150% threshold, measuring each arm with a single query. A single run is not a stable oracle: whichever query happens to be the first to touch a cache or spin up a thread pool absorbs a transient multi-megabyte allocation, and the dotted arm always runs first in the loop, so such a one-off lands on it and inflates the ratio arbitrarily. Locally the effect is easy to see: the first query after a server start reports 8–22 MB in this counter against a ~2.8 MB steady state for the identical query.

The test failed this way on at least 6 unrelated PRs since 2026-08-12 (e.g. Stateless tests (amd_asan_ubsan, distributed plan, parallel) on #104948 at commit 81300c2: longidx index analysis over a constant with 100000 dots allocated 4216780 bytes, more than 150% of the no-dots control (22224 bytes) — reruns passed; CIDB shows the same failure on #106011, #108522, #114475, #96130, #114476).

Measure each arm three times and take the minimum: a genuine quadratic regression is deterministic and shows up in every run, so the oracle keeps discriminating (the minimum can only remove one-sided transient noise), while a one-off transient can no longer fail the test. Verified against the current master binary: the modified test passes repeatedly.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Version info

  • Merged into: 26.8.1.1329 (included in 26.8 and later)
  • Backported to: 26.7.8.10, 26.6.6.13

The test compares `MemoryAllocatedWithoutCheckBytes` of a dotted-constant
`EXPLAIN indexes = 1` against a no-dots control with a 150% threshold, but it
measured each arm with a single query. Whichever query happens to be the first
to touch a cache or spin up a thread pool absorbs a transient multi-megabyte
allocation (locally reproducible: the first query after server start reports
8-22 MB against a 2.8 MB steady state), and the dotted arm always runs first,
so such a one-off lands on it and inflates the ratio arbitrarily. In CI the
test failed with a 4216780-byte dotted arm against a 22224-byte control on
several unrelated PRs.

Measure each arm three times and take the minimum: a genuine quadratic
regression is deterministic and shows up in every run, so the oracle keeps
discriminating, while a one-off transient can no longer fail the test.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [291359e]

Summary: ✅


AI Review

Summary

This PR makes the allocation oracle in 04780_json_subcolumn_index_match_not_quadratic robust against one-off cold-start allocations by running each EXPLAIN indexes = 1 query three times and taking the minimum MemoryAllocatedWithoutCheckBytes from system.query_log. I did not find a remaining correctness, coverage, or metadata issue in the current change: the test still exercises the same planner path, EXPLAIN already disables use_query_condition_cache, and the updated oracle now filters out the transient startup noise described in the PR without weakening the intended regression signal.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 13, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 291359ec9 with master 32385c7c5 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 692.30 MiB 689.29 MiB -3.01 MiB (-0.43%)

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.

Compile time of recompiled translation units

6 translation units recompiled, 5 s compile time in total, 6 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Aug 13, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 13, 2026
Merged via the queue into master with commit d5880fd Aug 13, 2026
182 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix/04780-min-of-runs-alloc-oracle branch August 13, 2026 13:38
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 13, 2026
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 13, 2026
alexey-milovidov added a commit that referenced this pull request Sep 13, 2026
`04780_json_subcolumn_index_match_not_quadratic` failed with

    FAIL: tokens index analysis over a constant with 100000 dots allocated
    4216780 bytes, more than 150% of the no-dots control (22224 bytes)

and the harness's own reruns then passed twice, both with and without
the randomized settings. This branch still measures a single run,
while `master` takes the minimum of three (#114608, 2026-08-13) - and
that commit's comment names this exact pair of byte counts as the
failure it was written for. #114608 is now labelled for 26.6 and 26.7,
so the oracle will stop being a single sample once it lands; this
merge re-triggers the workflow in the meantime.
@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 13, 2026
clickhouse-gh Bot added a commit that referenced this pull request Sep 13, 2026
Backport #114608 to 26.7: Make the 04780 index-analysis allocation oracle the minimum of several runs
clickhouse-gh Bot added a commit that referenced this pull request Sep 13, 2026
Backport #114608 to 26.6: Make the 04780 index-analysis allocation oracle the minimum of several runs
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Sep 18, 2026
…ocation oracle the minimum of several runs
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Sep 18, 2026
…ocation oracle the minimum of several runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-ci pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.6-must-backport v26.7-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants