Skip to content

Collect performance query coverage and select PR performance tests - #129327

Merged
egor-click merged 20 commits into
masterfrom
codex/perf-query-coverage
Nov 11, 2026
Merged

egor-click merged 20 commits into
masterfrom
codex/perf-query-coverage

Conversation

@egor-click

@egor-click egor-click commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🕵️‍♂️ Collect code coverage for performance queries and use it to choose whole performance test files for each PR. Setup, first execution, one warm execution and teardown have separate coverage records. Instrumented timings never enter the performance comparison tables.

The stateless selector (250-test cap) and integration selector (100-test cap) run independently. Their selected tests are combined without another cap, keeping each selector's existing protection rules. It also includes changed or uncovered tests, previous failures, a fixed set of 196 tests, and tests using changed headers covered by at most 300 tests. Only query execution coverage selects tests; setup and teardown still execute. Regions covered by more than 300 tests are ignored. Missing source mappings are reported explicitly.

Ordinary PRs use six shards per enabled architecture and run every query in each selected file. The pr-performance label runs all test files on eight ARM shards; AMD keeps coverage selection on six shards. Build inputs, performance harness/fixture/server configuration changes, setting-default changes and changes to src/Core/Defines.h automatically use the same ARM-full/AMD-selected routing and enable both architectures. The ci-force-all label runs the full suite on eight shards per architecture. Full runs retain the existing query sampling. Other job gates and Iceberg configurations are preserved.

The coverage collection was verified against actual CIDB rows: 808 eligible XML files, 7,132 queries, 15,880 phase identities and 155,093,308 coverage rows. All 16 assignments were complete and disjoint. Jobs took 5h17m–6h33m and used 93.4 runner-hours in total. Long and shell tests were explicitly excluded.

Collection validation: https://github.com/ClickHouse/ClickHouse/actions/runs/42269560085

Full CI passed at 50d2df0f10f024ebba0a449043ffaff6ad4e1168, including all 12 performance jobs. Its six ordinary performance jobs ran 234 files and all 1,361 queries on both binaries, taking 29m58s–43m56s and 3.66 runner-hours in total. CIDB contains 1,360 accepted comparisons; one comparison did not reproduce after restart and was omitted by the existing confirmation logic. Its raw measurements remain published.

Main PR CI: https://github.com/ClickHouse/ClickHouse/actions/runs/42337451902

The separate validation PR also passed full CI at 2d107d687be52547993a6ce2d713418a5881b413. It targets master and includes a small C++ optimization plus an added query. Without either full-suite label, it selected 241 of 823 files and ran all 1,666 queries, including all three new query expansions and every query in 18 files containing more than ten queries. All six ordinary performance jobs passed in 28m01s–57m47s, using 3.905 runner-hours. There were no missing queries or unexplained publication losses.

Execution validation: https://github.com/ClickHouse/ClickHouse/actions/runs/42339482393

Related: #129861
Related: #129176
Related: #129303

Changelog category (leave one):

  • CI Fix or Improvement

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

Collect per-query performance coverage, balance its 16 shards using instrumented runtimes, and select performance tests from PR code changes.


Workflow [PR]
Sync PR [sync-upstream/pr/129327]

Version info

  • Merged into: 26.11.1.1952-master (included in 26.11 and later)

Add separate instrumented shards to `NightlyCoverage`. Reuse `perf.py` to
collect setup, first execution, repeated execution, and teardown coverage,
with expanded-query hashes and snapshot manifests. Export source coverage
through the existing CIDB coverage pipeline; do not publish performance
measurements from instrumented runs.

Context:
#129176
#129303
@clickhouse-gh

clickhouse-gh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2cb79be]

Summary: ✅


AI Review

Summary

This PR collects performance-query coverage separately from timings and uses it to select whole performance tests. It adds balanced coverage shards, validated recovery, prior-failure retention, and architecture-specific routing between selected and full-suite runs. No actionable findings remain at 2cb79bedbf8388197c86a20eb2a781a124106bcb; the previously reported issues are addressed.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 4, 2026
Add a `suite=performance` input to `NightlyCoverage`, keeping the per-test
instrumented build and all eight performance coverage shards. Scheduled
runs and `suite=all` keep the full coverage workflow.

#129327
Comment thread ci/workflows/nightly_coverage.py Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Nov 4, 2026
All eight shards timed out while rewriting the 100M-row hits dataset with
LLVM instrumentation, before the test batch started. Attach the existing
parts and rename `datasets.hits_v1` to `test.hits`, like the PGO collector.
Record the dataset layout in the snapshot manifest. Keep the release-binary
timing job's data preparation unchanged.

#129327
https://github.com/ClickHouse/ClickHouse/actions/runs/41868661430
Give instrumented setup and fill statements a 30-minute execution limit.
Set the client socket timeout above both setup and benchmark statement
limits, allowing the server to report timeouts. Keep benchmark query
budgets and ordinary performance comparison behavior unchanged.

The coverage shard exceeded the normal 300-second limit while filling
100 million rows for `array_index_low_cardinality_strings.xml`.

https://github.com/ClickHouse/ClickHouse/actions/runs/41882280734/job/126764987340
#129327
Run each query once under `first` and once under `warm`. Let large XML
files use the remaining collection budget instead of stopping after one
hour. Keep the six-hour shard limit and twenty-minute export reserve.

Validated collector behavior, dispatch selection, generated workflows,
and assignment of all 808 eligible XML files exactly once.

Related: #129327
CI: https://github.com/ClickHouse/ClickHouse/actions/runs/41893002522
CI: https://github.com/ClickHouse/ClickHouse/actions/runs/41882280734/job/126764987340
@CLAassistant

CLAassistant commented Nov 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Add the optional `performance_shards` dispatch input so a corrected branch
revision can retry missing coverage without repeating successful shards.
Validate the requested shard numbers and keep scheduled collection unchanged.

Increase the coverage runner's default SQL statement budget to 30 minutes.
The six-hour shard limit and 20-minute export reserve remain in force.

Validated 17 collector tests, eight dispatch tests, generated workflows,
lint and diff checks. Real collection must confirm the longer query limit.

Related: #129327
CI: https://github.com/ClickHouse/ClickHouse/actions/runs/41918941469/job/126887932781
CI: https://github.com/ClickHouse/ClickHouse/actions/runs/41918941469/job/126887933123
CI: https://github.com/ClickHouse/ClickHouse/actions/runs/41882280734/job/126764987340
Restore validated whole-test artifacts from an explicit earlier workflow SHA,
retaining source/binary identity and per-test provenance. Interrupted XML tests
restart from setup; incomplete shards still cannot publish coverage.

Allow an explicit twelve-hour manual recovery budget for large XML files while
keeping the scheduled collector at six hours and preserving all sixteen shard
assignments and first-plus-one-warm execution. Retain completed Result records
and per-test wall time when a later test fails.

Related: #129327
https://github.com/ClickHouse/ClickHouse/actions/runs/41918941469
https://github.com/ClickHouse/ClickHouse/actions/runs/41882280734/job/126764987340
Require an immutable coverage artifact URL and unpacked SHA256 when resuming. Verify the binary before fixture setup so normal build-cache selection cannot change the executable used for saved coverage.

CI: https://github.com/ClickHouse/ClickHouse/actions/runs/42009599761
Partition only the original shard assignment, verify its pinned archive, and restore complete whole tests into their assigned recovery slots. Preserve normal scheduled sharding and require all recovery manifests before treating the source shard as complete.

CI: https://github.com/ClickHouse/ClickHouse/actions/runs/42042533306/job/127297514435
PR: #129327
Assign every eligible whole XML by longest-first measured collection cost.
Admit new tests with explicit estimates, invalidate weights for changed inputs,
and support refreshing weights from complete compatible manifests.

Remove one-off split recovery and raise the default collection budget to
twelve hours: `string_sort.xml` alone measured 6h36m51s. Preserve first-plus-one
warm collection, generic pinned resume and explicit phase completeness.

#129327
https://github.com/ClickHouse/ClickHouse/actions/runs/41918941469
https://github.com/ClickHouse/ClickHouse/actions/runs/42195391179
Reuse the shared selectors with query-only XML ownership, the approved
300-owner cutoff, header rule and fixed 196-test set. Run every query in
selected XMLs on six shards; full-run labels use eight existing-style shards.
Validate completed coverage identities before selecting and publish reasons.

Temporarily allow the implementation branch as a PR target for the requested
stacked CI validation; remove that target after validation.

Related: #129327
Coverage validation: https://github.com/ClickHouse/ClickHouse/actions/runs/42269560085
Keep the updated review-thread CI gate and apply the performance six/eight
shard decision before `ci-force-all`. Regenerate and lint the workflows.

Related: #129327
Coverage validation: https://github.com/ClickHouse/ClickHouse/actions/runs/42269560085
@egor-click egor-click changed the title Collect per-query LLVM coverage for performance tests Collect performance query coverage and select PR performance tests Nov 7, 2026
Read performance query identities and execution errors in their published
formats, and export blocking dashboard verdicts for subsequent selections.
Assemble complete coverage from compatible successful shard attempts while
preserving exact manifest binding, freshness and phase validation.

Related: #129327
Related: #129861
CI: https://github.com/ClickHouse/ClickHouse/actions/runs/42322389618
Coverage validation: https://github.com/ClickHouse/ClickHouse/actions/runs/42269560085
Comment thread ci/jobs/performance_tests.py Resolved
Choose the six- or eight-shard performance family in a PR configuration
pre-hook so `ci-force-all` cannot bypass the mutual exclusion. Remove the
temporary stacked-PR workflow target; validation continues against master.

Validated with the generated YAML, repository yamllint configuration and
10 focused routing/selection checks. The preceding implementation passed
all six selected performance shards with complete query publication.

#129327
https://github.com/ClickHouse/ClickHouse/actions/runs/42326271407
#129861
https://github.com/ClickHouse/ClickHouse/actions/runs/42269560085
Resolve the generated `finish_workflow.needs` conflicts using the updated
Praktika YAML generator. Preserve the existing performance job definitions,
including all 16 coverage shards and the six/eight execution shard families.

Validated generated YAML with the repository yamllint configuration, parsed
workflow equivalence, and the existing focused execution checks.

Related: #129327
Previous validation: https://github.com/ClickHouse/ClickHouse/actions/runs/42337451902
@egor-click
egor-click marked this pull request as ready for review November 9, 2026 12:27
@egor-click
egor-click requested review from fm4v and naushniki November 9, 2026 12:27
Keep AMD coverage selection on six shards while pr-performance runs the full ARM suite on eight shards. Preserve ci-force-all on both architectures.

Related: #129327
Keep the upstream job-filter reorganization and the architecture-aware performance pre-hook.

Related: #129327
@egor-click

Copy link
Copy Markdown
Contributor Author

attempt 1 failed due to stale coverage, latest manually triggered coverage collection workflow just finished and attempt 2 should be successful

Submodules, build files, compiler images, the performance harness and
fixtures, server configuration and setting defaults.

Related: #129327

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@naushniki

Copy link
Copy Markdown
Contributor

I added a commit, "Run the full performance suite for changes coverage cannot see".

Some changes affect performance without touching any covered source line. Right now the selector finds no tests for them, so the PR is measured only on the fixed set:

  • Build inputs: submodules, CMake files, compiler images.
  • The perf harness and fixtures: scripts, datasets, SeaweedFS setup, the performance-comparison and test-base images, the server config.
  • Changed setting defaults: Settings.cpp is excluded from coverage.

For these, full_suite_reason now returns a reason, so the PR runs the full suite on 8 shards, as with ci-force-all. Build changes reuse the filter_job.py helpers. For defaults, parse_declaration_changes adds a default_changed flag, so newly added settings don't trigger full runs. If the changed files or the settings data are unavailable, select fails in the perf job, not in the pre-hook.

ci/defs/defs.py and ServerSettings.cpp are left out on purpose: they change too often (34 and 77 changes on master from 2026-08-10 to 2026-11-10). I checked the routing locally with a throwaway script; it hasn't run in CI yet.

Include `src/Core/Defines.h` so changes to constants used by setting
defaults request the full ARM suite. Keep AMD on coverage selection and
enable its selected jobs for the same automatic requests. Preserve the
full-suite override on both architectures for `ci-force-all`.

Related: #129327
Review: #129327 (comment)
@egor-click
egor-click enabled auto-merge November 10, 2026 23:28
@egor-click
egor-click disabled auto-merge November 11, 2026 08:53
@egor-click
egor-click enabled auto-merge November 11, 2026 08:53
@egor-click
egor-click added this pull request to the merge queue Nov 11, 2026
Merged via the queue into master with commit 46bd374 Nov 11, 2026
203 checks passed
@egor-click
egor-click deleted the codex/perf-query-coverage branch November 11, 2026 12:57
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 11, 2026
middas-0706 pushed a commit to middas-0706/ClickHouse that referenced this pull request Nov 12, 2026
Pass the GitHub Actions job token to PR performance jobs with read-only
contents, pull-request and Actions permissions. Keep the token in the job
command environment so parent report publication uses its existing auth.

This prevents source mapping from using the anonymous GitHub API quota.

Related: ClickHouse#129327
CI failure: https://github.com/ClickHouse/ClickHouse/actions/runs/43119319956/job/130914755090
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). pr-ci 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.

5 participants