Skip to content

Skip 03096_order_by_system_tables under LLVM coverage builds - #103226

Merged
nikitamikhaylov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-03096-coverage-timeout
Apr 21, 2026
Merged

nikitamikhaylov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-03096-coverage-timeout

Conversation

@groeneai

@groeneai groeneai commented Apr 21, 2026 •

Copy link
Copy Markdown
Collaborator

The stateless test 03096_order_by_system_tables intermittently fails on Stateless tests (amd_llvm_coverage, */3) with:

Code: 159. DB::Exception: Timeout exceeded (180 s) while flushing system log
'DB::SystemLogQueue<DB::TraceLogElement>'. (TIMEOUT_EXCEEDED) (version 26.4.1.1093)

The test only does SYSTEM FLUSH LOGS /* all tables */ followed by a system.tables scan. Under LLVM source-based coverage the per-branch profiling overhead compounds across the trace_log backlog that parallel tests accumulate on the shared server, pushing SystemLogBase::waitFlush past its 180s default. The test itself has no timing assertions — the only path that fails here is the CI-shared trace_log flush.

This is the same failure mode as 01473_event_time_microseconds on the same build variant (see PR #103219). 30-day CIDB across all branches:

  • 7 failures across 6 unrelated PRs
  • All on amd_llvm_coverage* variants
  • 0 failures on amd_llvm_coverage master

Adding no-llvm-coverage follows the established precedent of 01473_event_time_microseconds, 00974_query_profiler, 01569_query_profiler_big_query_id, and commit cec04c1 (Kafka tests under coverage). The test still runs on every other build configuration so it continues to catch system-table sorting-key regressions.

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100777&sha=4892bb02456a3a49a0a21553f684b664020674c9&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%203%2F3%29

Changelog category (leave one):

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

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

Skip timing-sensitive system log test under LLVM coverage builds.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.1104

The test issues `SYSTEM FLUSH LOGS /* all tables */`, which triggers
flushing every system log (including `trace_log`) and must wait for the
shared backlog accumulated by all parallel tests on the same server.
Under LLVM source-based coverage instrumentation the per-branch profiling
overhead accumulated in the `trace_log` queue pushes the server-side
`waitFlush` call past its 180s timeout in `SystemLogBase.cpp`, producing:

  Code: 159. DB::Exception: Timeout exceeded (180 s) while flushing
  system log 'DB::SystemLogQueue<DB::TraceLogElement>'. (TIMEOUT_EXCEEDED)

This is the same failure mode that `01473_event_time_microseconds` hits
on the same build variant. 30-day CIDB shows 7 failures across 6 unrelated
PRs (~0.056% on amd_llvm_coverage, 0 master failures on amd_llvm_coverage).
The test verifies sorting-key correctness for system tables — a property
that has nothing to do with coverage instrumentation — so skipping on
`amd_llvm_coverage` preserves the test's ability to catch regressions on
every other build variant.

Follows precedent of `01473_event_time_microseconds` (PR ClickHouse#103219),
sibling query-profiler tests `00974_query_profiler`,
`01569_query_profiler_big_query_id`, and commit cec04c1
(Kafka tests under coverage).

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100777&sha=4892bb02456a3a49a0a21553f684b664020674c9&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%203%2F3%29
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate (self-review)

a) Deterministic repro?
Not locally — amd_llvm_coverage is a CI-only variant. The CI signature is deterministic though: 7 failures across 6 unrelated PRs in 30 days, all on Stateless tests (amd_llvm_coverage, */3), all with the identical stack (Timeout exceeded (180 s) while flushing system log 'DB::SystemLogQueue<DB::TraceLogElement>').

b) Root cause explained?
Yes. SYSTEM FLUSH LOGS /* all tables */ enqueues a flush of trace_log and waits for the server-side consumer to drain it. trace_log is a shared queue across the whole parallel test run — when many coverage-instrumented tests are executing, the queue depth is much larger than on any other build, and the SystemLogBase::waitFlush 180s timeout fires before the consumer catches up.

c) Fix matches root cause?
Yes. The test has no role in verifying the flush path — it only uses it to observe system.tables. Removing the test from the amd_llvm_coverage runs eliminates the timeout without weakening any other variant. This is exactly the approach taken for the sibling tests listed in the comment.

d) Test intent preserved?
Yes. The assertion (detect system MergeTree tables whose sorting key diverged from (event_date, event_time)) is preserved on every non-coverage build. Coverage builds do not provide unique coverage of system-table sorting keys — they are instrumentation variants of the same code.

e) Both directions demonstrated?
CI side: 30-day failure history on amd_llvm_coverage* is documented in the PR body. Post-fix: the test will be SKIPPED under no-llvm-coverage rather than run and time out. The test continues to run on all other variants (master CIDB confirms that's where it currently passes every run).

Session: cron:clickhouse-ci-task-worker:20260421-041500

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov — could you review this? It adds no-llvm-coverage to 03096_order_by_system_tables following the exact precedent you set in commit cec04c1 (Kafka tests under coverage) and the sibling 01473_event_time_microseconds fix in PR #103219. The test's SYSTEM FLUSH LOGS /* all tables */ exceeds the 180s waitFlush timeout on coverage builds due to the trace_log backlog from parallel tests.

@alexey-milovidov alexey-milovidov self-assigned this Apr 21, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Apr 21, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [816fe2d]

Summary: ✅


AI Review

Summary

This PR adds no-llvm-coverage to tests/queries/0_stateless/03096_order_by_system_tables.sql with a detailed rationale about intermittent SYSTEM FLUSH LOGS timeout behavior under LLVM coverage instrumentation. The change is narrowly scoped to CI stability for a timing-sensitive test and is consistent with existing precedent for similar profiler/log-flush tests. I did not find correctness, safety, performance, or compatibility issues in the patch itself.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ➖
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 21, 2026
@nikitamikhaylov
nikitamikhaylov added this pull request to the merge queue Apr 21, 2026
Merged via the queue into ClickHouse:master with commit e5b487b Apr 21, 2026
162 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 21, 2026
subkanthi pushed a commit to subkanthi/ClickHouse that referenced this pull request Apr 24, 2026
…n amd_llvm_coverage

Adds `no-llvm-coverage` tag — under LLVM source-based coverage instrumentation the
server is ~3-5x slower, and with `memory_profiler_sample_probability = 1` the test
emits many `MemorySample` trace rows. The server-side `SystemLogQueue<TraceLogElement>`
flush then routinely exceeds its 180s deadline, emitting `Code: 159 TIMEOUT_EXCEEDED`
into stderr and causing the `clickhouse-test` stderr-empty check to report the test
as `FAIL` even when the assertion output itself is correct.

CIDB evidence (30 days):
- 34 failures, 25+ distinct unrelated PRs, 4 master hits — all on `amd_llvm_coverage`
  variants only (1/3, ParallelReplicas+s3+parallel, AsyncInsert+s3+parallel).
- Zero failures on debug, asan_ubsan, tsan, msan, release, binary builds in the same
  window.
- Health check: in 7 days the test has 657-706 OK runs on each of the 4 coverage
  variants (so it passes most of the time; 180s deadline is a rare stochastic trip).

Same pattern and fix as the recent sibling coverage flakes:
  ClickHouse#103287, ClickHouse#103288, ClickHouse#103293, ClickHouse#103298, ClickHouse#103226, ClickHouse#103219.

Closes the `ci-02818memoryprofilersampleminmax` chronic-flaky tracking task.
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jun 10, 2026
The test relies on a precise memory-tracking cadence between two distributed
shards: the shard allocating `groupArray(repeat('a', 100000))` per row must
hit `max_memory_usage=1G` and emit `Query memory limit exceeded` before the
other shard cancels. Under LLVM source-based coverage instrumentation the
per-branch profiling overhead perturbs this cadence and the expected exception
occasionally does not surface on `127.3` before the query is cancelled,
producing an empty `grep` match and a FAIL.

30-day CIDB at the time of the fix: 7 hits on `Stateless tests
(amd_llvm_coverage, 1/3)` across 7 distinct PRs, 1 master hit on 2026-04-21,
2 hits on the `amd_llvm_coverage, AsyncInsert, s3 storage` variant, 0 hits on
any non-coverage stateless configuration.

Applies the same direction as sibling coverage-timing tests
`03096_order_by_system_tables` (ClickHouse#103226, merged) and
`01473_event_time_microseconds` (ClickHouse#103219). The test remains covered by all
non-coverage configurations and by the excluded-from-llvm runner variant that
specifically runs tests tagged `no-llvm-coverage`.

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=99c45393710200ab19c3ff17b45badf63b466559&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%201%2F3%29

Co-Authored-By: Claude Opus 4.8 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
When the server dies (hung check or crash), `clickhouse-test` exits with
a non-zero code, which previously caused a redundant `clickhouse-test error`
entry to appear alongside `Server died` in the CI report.

Now when `Server died` is already reported, skip the redundant entry and
instead call `check_fatal_messages_in_logs` to check for a crash cause
(signal, sanitizer error, or fatal message in the server log) via
`FuzzerLogParser`. Any failures found are added to the report.

Example failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103226&sha=816fe2dd57bc64e3bc66048a0956155d3d42f51c&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29
(corresponding PR: ClickHouse#103226)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors 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