Skip to content

Revert "Revert "Make LLVM coverage opt-in in pull requests, run the same configurations on arm_binary"" - #123790

Merged
fm4v merged 31 commits into
masterfrom
revert-123789-revert-122853-nik/pr-coverage-opt-in
Oct 8, 2026
Merged

fm4v merged 31 commits into
masterfrom
revert-123789-revert-122853-nik/pr-coverage-opt-in

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Related: #122853
Related: #123789
Related: #124021
Related: #123657
Related: #124015

Changelog category (leave one):

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

Description

This brings back #122853 (reverted in #123789): pull requests run LLVM coverage only with the ci-coverage label and run the same configurations on arm_binary by default.

What happened:

Changes compared to #122853:


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

Version info

  • Merged into: 26.10.1.1871-master (included in 26.10 and later)

@mintlify

mintlify Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Oct 7, 2026, 6:33 PM

@alexey-milovidov
alexey-milovidov requested a review from fm4v October 4, 2026 00:15
@clickhouse-gh

clickhouse-gh Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [17cc1c3]

Summary: ✅


AI Review

Summary

This PR restores the PR-side replacement for the always-on LLVM coverage lanes: unlabeled pull requests run the equivalent arm_binary DBReplicated / ParallelReplicas / AsyncInsert stateless jobs and full arm_binary integration batches, while ci-coverage (or selected coverage-code changes) switches back to the real LLVM coverage family. The remaining problem is that the new _LLVM_COVERAGE_ONLY_PATHS trigger is still narrower than the behavior it claims to protect, so several edits to LLVM-coverage-only runner logic still skip the real coverage jobs and get validated only by the arm_binary replacements.

Findings
  • ⚠️ Major — [ci/jobs/scripts/workflow_hooks/filter_job.py:163] _LLVM_COVERAGE_ONLY_PATHS still omits files whose meaningful branches only run under the real LLVM coverage family. Today, a PR that changes only ci/jobs/unit_tests_job.py, ci/jobs/functional_tests.py, ci/jobs/integration_test_job.py, or ci/jobs/scripts/integration_tests_configs.py still makes should_skip_job skip Unit tests (amd_llvm_coverage), the amd_llvm_coverage stateless shards, the amd_llvm_coverage integration shards, and LLVM Coverage, while running only the arm_binary replacements. That leaves LLVM-specific behavior such as *.profraw merge/publish paths and the coverage-only integration selection logic unvalidated unless the author remembers to add ci-coverage manually. Suggested fix: expand _LLVM_COVERAGE_ONLY_PATHS (or an equivalent predicate) to cover every file whose coverage-specific branches are not exercised by the replacements, or move those branches into dedicated helper modules that are listed there.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required action: make real LLVM coverage auto-run for edits to the remaining LLVM-only runner/selector code, not just the merge/report helpers.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Oct 4, 2026
groeneai and others added 6 commits October 4, 2026 00:18
…ryVisitor

`ApplyWithSubqueryVisitor` registered as a substitutable literal only the
alias of a direct `WITH` child, so in `WITH tuple([7] AS nested) AS wrapper`
it registered `wrapper` but not `nested`. A nested `SELECT` using `7 IN nested`
then kept the identifier, and the full `AddDefaultDatabaseVisitor` traversal,
which treats every name left in place as a table, qualified it as
`<db>.nested`. A view, a materialized view, `MODIFY QUERY` and
`ALTER TABLE ... UPDATE` with that shape read a same-named table instead of
the alias, or failed with `UNKNOWN_IDENTIFIER` (reproduced on 26.8.2.7 and
26.3.33.24).

The narrow pass that repairs a definition after SQL UDF expansion already
takes the aliases at any depth of a `WITH` expression, not inside a lambda or
a subquery, like the analyzer. A `Replicated` database writes that repaired
text into the DDL log and every replica processes it again through the full
pipeline, which re-qualified the alias. This made
`05237_with_expression_alias_scope_descendant` fail on every run under
`--replicated-database`.

Register every such alias right after the expression is visited, as the
direct child's alias was before, so it is inlined (`7 IN ([7] AS nested)`)
the way a top-level alias has been since #100042. The rule now lives in one
helper, `ApplyWithSubqueryVisitor::forEachWithExpressionAlias`, which the
narrow pass also calls.

The test gets back the mutation arms removed in the #114908 rework, each on
its own row, and a hand-written view arm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y are visited

An alias inherited from an enclosing `WITH` was substituted even into a nested
select that declares the same alias itself, where the analyzer resolves the
local one. A non-CTE `WITH` child was visited as a whole before its aliases
were registered, so a later part of the same expression did not see one.

Test arms: a materialized view and `MODIFY QUERY`, a later part of the same
`WITH` expression, and nested selects that shadow a descendant or a top-level
alias.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…TH` alias

A nested select's `ARRAY JOIN` and `JOIN ... ON` aliases were not counted as its own, so an inherited alias still replaced them.
A lambda body got the inherited aliases unchanged, so one was substituted over a lambda parameter or a body alias of the same name.
Add a stack check to the recursive alias walk.
Test arms: `ARRAY JOIN`, `JOIN ... ON`, a lambda parameter and a lambda-body alias that bind the same name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The analyzer puts the aliases inside a table function's arguments into the select scope,
so `ApplyWithSubqueryVisitor` now counts them among a nested select's own aliases, and
`AddDefaultDatabaseVisitor::collectAliases` descends into those arguments (not into the
table alias) so the dropped name stays bare. Both must change together, otherwise the
name is either inlined or qualified as a table. 05237 gains a table function shadow arm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The analyzer stops collecting aliases at a lambda, also inside a table
function argument, but `collectAliases` walked into it there. A
lambda-body alias then left an unrelated table name bare in a stored
view, so the view read that name from the reader's current database.
Take the argument aliases with `forEachExpressionAlias`, as the visitor
does.

Adds a test arm read through `USE system`, and moves the own-alias scan
above the comment that describes the `scope_data` block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop a comment that restates its call and shorten the visitWithExpression comment to one line.

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

clickhouse-gh Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 2a290a03b with master a55efadaa (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 98cee6e8d; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

12 object files changed (+37.29 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Interpreters/ApplyWithSubqueryVisitor.cpp.o 88.99 KiB 107.18 KiB +18.19 KiB (+20.44%)

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

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

Job report

… `find_tests.py` to the pipeline paths

A pull request changing the code that only the LLVM coverage jobs run (collection,
merge, diff report) now runs those jobs as if it had the `ci-coverage` label, and
skips their `arm_binary` replacements, since the replacements do not exercise that code.

`ci/jobs/scripts/find_tests.py` narrows the `arm_binary` replacement jobs down to the
batches containing a changed test, so a change to it now runs those jobs too.

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

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123790&sha=623eb9f55ca9aa826d7ccf9c6e070ee2a5e19729&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29 (05294_time_series_samples_ttl returns every timeSeriesTags row twice under parallel replicas; it did not reproduce in 60 reruns) and provide a fix in a separate PR. If the fix is already in progress, link it here.

The Stress test (arm_asan_ubsan) hung check (https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123790&sha=623eb9f55ca9aa826d7ccf9c6e070ee2a5e19729&name_0=PR&name_1=Stress%20test%20%28arm_asan_ubsan%29) is a BACKUP ... ON CLUSTER stuck for 1673 s under Keeper fault injection. It also happens on master and looks covered by #123752.

@groeneai

groeneai commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

No separate PR from me: 69d620b in this PR already adds the no-parallel-replicas tag to 05294_time_series_samples_ttl. With parallel replicas, timeSeriesTags returns each row once per replica that reads it (#118130), the same defect as in 05059, 05182 and 04838, which #123763 tagged. The engine fix is #118518. Apart from the already tagged tests, no TimeSeries test fails in the ParallelReplicas lanes on unrelated PRs (CIDB, last 7 days).

alexey-milovidov and others added 3 commits October 8, 2026 07:56
…age pipeline path

A pull request that only regenerates the workflow file changes the `needs` / `if`
wiring of the coverage jobs and their `arm_binary` replacements, so it must not
skip them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With parallel replicas the reads happen in the queries of other replicas, so the
`ColumnsCache` hit and miss events are missing from the initiator's `query_log` entry.
The `ParallelReplicas` configuration on `arm_binary` added by this PR exposes it.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123790&sha=69d620b19ab28561a9b729590904256aada6a2fb&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20sequential%29
#123790

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

Copy link
Copy Markdown
Member Author

🕵 Merged master and addressed the open review thread (c07a426). The only CI failure, 04064_columns_cache_metrics in Stateless tests (arm_binary, ParallelReplicas, s3 storage, sequential), only fails in this new lane (CIDB, last 14 days): with parallel replicas the ColumnsCache hit and miss events are missing from the initiator's query_log entry. It is now tagged no-parallel-replicas (07a5b1c). @groeneai, thanks for confirming 05294_time_series_samples_ttl. That fix was already in 69d620b.

# The part of `_COVERAGE_PIPELINE_PATHS` used only by the LLVM coverage jobs: collecting,
# merging and reporting the coverage. The `arm_binary` replacement jobs do not run this code,
# so a pull request changing it runs the LLVM coverage jobs as if it had the `ci-coverage` label.
_LLVM_COVERAGE_ONLY_PATHS = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This new _LLVM_COVERAGE_ONLY_PATHS split is still too narrow for the "coverage-code changes auto-run real coverage" contract.

A PR that changes only ci/jobs/unit_tests_job.py, ci/jobs/functional_tests.py, or ci/jobs/integration_test_job.py still skips Unit tests (amd_llvm_coverage), the amd_llvm_coverage shards, and LLVM Coverage, and runs only the arm_binary replacements instead. I verified that with should_skip_job using changed_files = ['ci/jobs/unit_tests_job.py']: the coverage jobs return Skipped: pull requests run LLVM coverage only..., while the replacement jobs run.

That means LLVM-specific branches such as the *.profraw merge/publish paths in those runner files are no longer exercised unless someone remembers to add ci-coverage manually. Please either factor the LLVM-only helpers into dedicated modules and list those here, or treat these runner files as coverage-only triggers too.

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.

🕵 Agreed. Commit 955a0f5 adds ci/jobs/functional_tests.py, ci/jobs/integration_test_job.py and ci/jobs/unit_tests_job.py to _LLVM_COVERAGE_ONLY_PATHS, because their *.profraw collect/merge branches only run in the coverage jobs. With that change, _has_llvm_coverage_only_changes returns true for each of them. I could not push it here: the PR is in the merge queue (enqueued 2026-10-08T21:43:21Z), and GitHub refuses updates to queued branches. The commit is on branch continue-pr-123790-coverage-runners. It goes into this PR if the PR is dequeued, or into a small follow-up PR once this one merges.

@fm4v
fm4v enabled auto-merge October 8, 2026 20:12
@fm4v
fm4v added this pull request to the merge queue Oct 8, 2026
Merged via the queue into master with commit 2b61e71 Oct 8, 2026
164 checks passed
@fm4v
fm4v deleted the revert-123789-revert-122853-nik/pr-coverage-opt-in branch October 8, 2026 22:44
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 8, 2026
groeneai pushed a commit to groeneai/ClickHouse that referenced this pull request Oct 10, 2026
… build

Master no longer builds `amd_llvm_coverage` or runs the LLVM coverage functional, integration and unit test jobs, the `excluded_from_llvm` integration job and the `LLVM Coverage` report job. The `DBReplicated`, `ParallelReplicas` and `AsyncInsert` stateless configurations and the full integration run now use the `arm_binary` jobs defined by ClickHouse#123790, so master runs the same configurations as pull requests.

Related: ClickHouse#124015
kute1654 pushed a commit to kute1654/ClickHouse that referenced this pull request Oct 10, 2026
ClickHouse#123711 fixed ClickHouse#123993, which ClickHouse#123790 tagged the test `no-parallel-replicas` for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Oct 11, 2026
On the s3-storage stateless lanes all temporary data goes into cached_s3
(temporary_data_in_cache). The cache has no cache_policy, so it uses the
default SLRU with slru_size_ratio 0.6, and new (temporary) file segments
can only use the probationary share: 40% of max_size, i.e. 2 GiB of 5Gi.
Segments that are being written are not evictable, so every concurrent
spill of a parallel run shares a hard 2 GiB pool while the protected 3 GiB
stays unused for them.

With the ParallelReplicas lane settings 04033_tpc_ds_q04 spills 1.55 GiB
and 04033_tpc_ds_q11 0.71 GiB (failing jobs' query_log); whichever of the
two reserves past 2 GiB first fails with NOT_ENOUGH_SPACE "for temporary
file: reason cannot evict enough space ... Ephemeral hold 2.00 GiB". They
started overlapping when ClickHouse#123790 moved the ParallelReplicas + s3
configuration from amd_llvm_coverage (q04 skipped there) to arm_binary.

10Gi gives a 4 GiB probationary pool; the sum of every test's maximum
spill in the failing jobs is about 3.5 GiB. Same knob as ClickHouse#95103.

Validated with a master build, local MinIO and two configs that differ
only in this file: a 2.45 GiB GROUP BY spill fails 3/3 on 5Gi and passes
3/3 on 10Gi (on 10Gi it fails at exactly 4.00 GiB); q04 + q11 run
together failed 12/20 on 5Gi and passed 20/20 and 100/100 on 10Gi.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

4 participants