Skip to content

Fix Logical error 'clock' in EXPLAIN ANALYZE over a streaming read nested in a subquery - #110935

Merged
Fgrtue merged 15 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-explain-analyze-streaming-subquery-clock
Jul 28, 2026
Merged

Fgrtue merged 15 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-explain-analyze-streaming-subquery-clock

Conversation

@groeneai

@groeneai groeneai commented Jul 18, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #110668

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix Logical error: 'clock' (in debug/sanitizer builds the server dies; an infinite hang in release builds) when running EXPLAIN ANALYZE over a query with a streaming (FROM ... STREAM) read that is not a plain top-level table expression: nested in a subquery (for example inside WHERE ... IN (...) or a CTE), or hidden behind an ordinary or parameterized view. EXPLAIN ANALYZE now rejects such queries with NOT_IMPLEMENTED, the same way it already rejects a top-level streaming read.

Description

EXPLAIN ANALYZE does not support streaming reads and rejects them up front in rejectStreamingForExplainAnalyze. The check enumerated table expressions with extractTableExpressions(query_tree, recursive=true), which only recurses into the join tree of QUERY/UNION nodes. A FROM ... STREAM read living outside the join tree (in a WHERE/PREWHERE IN subquery, or a CTE) slipped past the check and reached execution. Its pipeline splices in a source built from a transient nested query plan that the per-step wall-clock registry (StepWallClockRegistry::populateFromPlan) never walked, so chassert(clock) in ExecutionThreadContext::executeTask fired in debug/sanitizer builds; release builds do not assert but hang forever because the streaming read never completes.

The fix walks the whole query tree (a ConstInDepthQueryTreeVisitor) instead of only join-tree table expressions, so a streaming read anywhere in a subquery is rejected with the same NOT_IMPLEMENTED error as a top-level one.

Found by the AST fuzzer (STID 2508-3665): report https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110705&sha=b886cba9cb881d23290434cd01b18d2799f6cb2f&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29

Regression coverage added to 04538_explain_analyze_stream_read.sql.

Streaming reads behind a view (added during review)

The automated reviewer pointed out that the query-tree walk cannot see a streaming read reached through a view: an ordinary view stays an opaque TableNode unless analyzer_inline_views is enabled (off by default), and a parameterized view is always a StorageView backed TableNode whose inner SELECT is planned separately in StorageView::readImpl. Confirmed: EXPLAIN ANALYZE SELECT * FROM v, where v is ... FROM t STREAM, aborted the server with Logical error: 'clock', for both an ordinary and a parameterized view.

The rejection is therefore also applied to the built query plan, walked exactly the way StepWallClockRegistry::populateFromPlan walks it (children plus getChildPlans). That reaches every step which can be timed, including the ones spliced in from a view's inner plan. Because a read which is not in the plan cannot be timed, it is not rejected, so a folded EXISTS over a streaming read keeps working: with execute_exists_as_scalar_subquery = 1 (the default) it folds to a constant at analysis and EXPLAIN ANALYZE still succeeds.

Regression coverage extended with an ordinary view, the same view under analyzer_inline_views = 1, and a parameterized view.

Not addressed here, because they are not specific to EXPLAIN ANALYZE and are not the clock error: a STREAM read used as a scalar subquery, or as an IN set, blocks indefinitely, but it blocks identically with no EXPLAIN at all and even under plain EXPLAIN, which never executes (measured; no fatal, server alive). That is a property of draining a STREAM source rather than of EXPLAIN ANALYZE.

…sted in a subquery

EXPLAIN ANALYZE rejects streaming (FROM ... STREAM) reads before execution in
rejectStreamingForExplainAnalyze. The check used extractTableExpressions with
recursive=true, which only recurses into the join tree of QUERY/UNION nodes, so a
streaming read nested in a WHERE/PREWHERE IN subquery or a CTE slipped through and
reached execution. Its pipeline splices in a source built from a transient nested
query plan that StepWallClockRegistry::populateFromPlan never walked, so chassert(clock)
in ExecutionThreadContext::executeTask fired in debug/sanitizer builds; release builds
did not assert but hung forever because the streaming read never completes.

Walk the whole query tree instead of only join-tree table expressions, so a streaming
read anywhere in a subquery is rejected with NOT_IMPLEMENTED like a top-level one.

Found by the AST fuzzer (STID 2508-3665).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. SET enable_streaming_queries=1; SET enable_analyzer=1; then EXPLAIN ANALYZE SELECT a FROM t WHERE b IN (SELECT b FROM t INTERSECT ALL SELECT b FROM t STREAM) (the fuzzed shape) triggers it every time: pre-fix it reaches execution and hangs; the CI debug build aborts with chassert('clock') (fatal.log: ExecutionThreadContext.cpp:112).
b Root cause explained? rejectStreamingForExplainAnalyze enumerated streaming tables via extractTableExpressions(query_tree, recursive=true), which only recurses into the join tree of QUERY/UNION nodes. A FROM ... STREAM read nested in a WHERE/PREWHERE IN subquery or a CTE is not in the join tree, so it bypassed the guard and reached execution. Its pipeline injects a source from a transient nested plan that StepWallClockRegistry::populateFromPlan never walked, so find(step,group) returns nullptr and chassert(clock) fires (debug); release does not assert but hangs (streaming read never completes).
c Fix matches root cause? Yes. Replaces the join-tree-only enumeration with a ConstInDepthQueryTreeVisitor that walks the whole query tree, so any streaming read (incl. in subqueries/CTEs) is detected and rejected with NOT_IMPLEMENTED. Directly closes the enumeration gap, not a symptom.
d Test intent preserved / new tests added? Yes. Extends the feature's own 04538_explain_analyze_stream_read.sql with the previously-uncaught shapes (streaming in WHERE IN, in INTERSECT ALL-in-IN, in a CTE). No existing assertion weakened.
e Both directions demonstrated? Yes. Pre-fix binary (Build ID bd4dbdf0): the shapes above reach execution and hang (rc 124); top-level FROM t STREAM already rejected (control). Post-fix binary (Build ID a4fee7f8): all execution-path streaming-subquery shapes → NOT_IMPLEMENTED; non-streaming EXPLAIN ANALYZE still runs; server alive, no chassert. Regression test 20/20 with randomization on.
f Fix is general across code paths? Yes. A single full-tree visitor covers every nesting position (IN, INTERSECT, GROUP BY, DISTINCT, CTE, PASTE), not just the one fuzzed shape; each verified to reject. Not a point patch.
g Fix generalizes across inputs? Yes. Verified across subquery kinds and set operations. Constant-folded scalar/uncorrelated-EXISTS subqueries were analyzed explicitly: they fold to a constant at analysis and run harmlessly (do not trigger the bug), so they are intentionally out of scope rather than silently missed.
h Backward compatible? (maintainer-approved exception only) N/A for stable behavior. EXPLAIN ANALYZE is a new (26.7) feature; this only turns a debug-abort / release-hang into the already-intended NOT_IMPLEMENTED rejection. No setting, format, or protocol change.
i Invariants and contracts preserved? Yes. No change to the wall-clock registry, executor, or streaming engine; only the pre-execution validation guard is broadened. The "streaming + EXPLAIN ANALYZE → NOT_IMPLEMENTED" contract is now upheld uniformly for every position in the query tree.

Session id: cron:clickhouse-author-slot-0:20260718-094500

@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review — adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; bounded: 1 full pass + 1 fix round + 1 delta recheck).

# Sev Finding Verdict Evidence / action
1 ❌ Round 1 (against branch HEAD): "diff only revises play.html comments, not InterpreterExplainQuery.cpp / the test" DISAGREE (wrong-base artifact) Round 1 diffed the branch tip used only as the reproduction base; the fix was still uncommitted in the working tree (confirmed present via git diff --stat: the two intended files, +24/-3). Recommitted onto a fresh origin/master branch.
2 ✅ Round 2 (against the committed fix diff) AGREE 0 findings on the committed diff.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding. Findings on hunks unchanged by the fix round are auto-dropped.

Session id: cron:clickhouse-author-slot-0:20260718-094500

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @Fgrtue @george-larionov — could you review this? It broadens rejectStreamingForExplainAnalyze (added with the reintroduced EXPLAIN ANALYZE in #110668) to walk the whole query tree instead of only join-tree table expressions, so a FROM ... STREAM read nested in a WHERE/IN subquery or a CTE is rejected with NOT_IMPLEMENTED up front instead of hitting chassert('clock') in debug (or hanging in release). Found by the AST fuzzer (STID 2508-3665).

@clickhouse-gh

clickhouse-gh Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c0d3fce]

Summary: ✅


AI Review

Summary

This PR correctly fixes the original clock exception for top-level and view-backed FROM ... STREAM reads under EXPLAIN ANALYZE, but one user-visible gap remains in the new rejection path. The current implementation only scans the pre-optimization plan, so set-building subqueries added later can still reach a streaming read and hang instead of returning NOT_IMPLEMENTED.

Findings
  • ⚠️ Majors
  • [dismissed by author -- https://github.com/Fix Logical error 'clock' in EXPLAIN ANALYZE over a streaming read nested in a subquery #110935#discussion_r3656486222] [src/Interpreters/InterpreterExplainQuery.cpp:758-870, 1232-1234; src/Processors/QueryPlan/QueryPlan.cpp:804-813; src/Processors/QueryPlan/CreatingSetsStep.cpp:205-245] rejectStreamingForExplainAnalyze(result->plan) runs before plan.optimize(...), but IN/set subquery plans are only attached during addStepsToBuildSets. As a result, EXPLAIN ANALYZE ... WHERE x IN (SELECT * FROM v) with v AS SELECT ... STREAM still bypasses the new guard even though the PR now describes plan-level rejection for view-hidden streaming reads. I still consider this real because the late-built set plans are exactly the ones the current walk cannot see.
  • Suggested fix: either run the streaming-plan walk again after plan.optimize(...), or inspect DelayedCreatingSetsStep subquery sources before they are materialized into child plans.
Final Verdict

⚠️ Changes requested: the original clock exception path is fixed, but EXPLAIN ANALYZE can still miss view-hidden streaming reads that enter through late-built set subqueries.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jul 18, 2026
@Fgrtue Fgrtue added the can be tested Allows running workflows for external contributors label Jul 18, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 506a7b3

Every failure below has an owner. This PR's diff is InterpreterExplainQuery.cpp (EXPLAIN-ANALYZE streaming-read rejection) + a stateless test — none of the failures below are in or reachable from that diff (verified pre-existing/chronic across many unrelated PRs). No PR-caused failure.

Check / test Reason Owner / fixing PR
Integration tests (amd_tsan, 3/6) / test_replicated_database::test_replicated_table_structure_alter flaky (chronic: 91 master + 20+ unrelated PRs/30d) #110030 (ours, open)
Upgrade check (amd_release) / Error message in clickhouse-server.log (DiskLocalCheckThread CANNOT_READ_ALL_DATA) flaky (disk-checker teardown race, error-log leak; dozens of unrelated PRs/30d) #110773 (ours, open)
Stress test (amd_msan) / Hung check failed, possible deadlock found deadlock (chronic hung-check family) #108212 (ours, merged) / #105905 (ours, merged)

Session id: cron:our-pr-ci-monitor:20260718-163000

@Fgrtue Fgrtue self-assigned this Jul 19, 2026

@Fgrtue Fgrtue left a comment

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.

It looks right to me. The traversal is correct, the chosen class for visitor is also fine.

Fgrtue added 4 commits July 19, 2026 14:52
Fgrtue added 4 commits July 21, 2026 16:54
…ai/fix-explain-analyze-streaming-subquery-clock
…ai/fix-explain-analyze-streaming-subquery-clock
…ai/fix-explain-analyze-streaming-subquery-clock
…ai/fix-explain-analyze-streaming-subquery-clock
Fgrtue added 4 commits July 24, 2026 11:32
…ai/fix-explain-analyze-streaming-subquery-clock
…ai/fix-explain-analyze-streaming-subquery-clock
…ai/fix-explain-analyze-streaming-subquery-clock
…ai/fix-explain-analyze-streaming-subquery-clock
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 7607212

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Stress test (amd_debug) / Inconsistent KeyCondition behavior (STID 5182-2f27) KeyCondition monotonicity canary, trunk bug #109023 (ours, open)
Upgrade check (amd_release) / Error message in clickhouse-server.log (MergeTreeData: Failed to read version metadata, Code 27 -> Code 246) trunk error-log leak, chronic across 25+ unrelated PRs #111772 (ours, open)

Fast test, Style check and Bugfix validation (functional + unit) are green on this head, so neither failure is caused by this PR's diff.

Session id: cron:our-pr-ci-monitor:20260726-163000

@alexey-milovidov

Copy link
Copy Markdown
Member

Investigating...

…ai/fix-explain-analyze-streaming-subquery-clock
The query-tree walk added earlier cannot see a streaming read reached through a
view: an ordinary view stays an opaque `TableNode` unless `analyzer_inline_views`
is enabled (off by default), and a parameterized view is always a `StorageView`
backed `TableNode` whose inner SELECT is planned separately in
`StorageView::readImpl`. So `EXPLAIN ANALYZE SELECT * FROM v`, where `v` is
`... FROM t STREAM`, still reached the streaming read and aborted with
`Logical error: 'clock'` in debug/sanitizer builds (the server dies), instead of
returning `NOT_IMPLEMENTED`.

Check the built query plan as well, walking it exactly the way
`StepWallClockRegistry::populateFromPlan` does (children plus `getChildPlans`).
That walk reaches every step which can be timed, including the ones spliced in
from a view's inner plan, and a read absent from the plan cannot be timed and so
is not rejected. This keeps a folded `EXISTS` subquery over a streaming read
working: with `execute_exists_as_scalar_subquery = 1` (the default) it folds to a
constant at analysis, no streaming source reaches the plan, and `EXPLAIN ANALYZE`
still succeeds.

Regression coverage added for an ordinary view, the same view with
`analyzer_inline_views = 1`, and a parameterized view.

Reported by the automated reviewer on ClickHouse#110935.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Fgrtue

Fgrtue commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

I don't think that this is a good solution anymore. I don't like the fact that there are more cases arising in which it can appear that Streaming Queries are not covered. I think even though semantically EXPLAIN ANALYZE for Streaming Queries doesn't make sense, we could still mark the processors in the "local plan" that are created in the processors with some step that still exists in the plan. This is semantically senseless, but senseless doesn't mean wrong (like making const rvalue reference in c++).

I will prepare fix in other PR and then close this one. @groeneai don't do anything

@groeneai

Copy link
Copy Markdown
Collaborator Author

Understood, I will leave this to you and not touch the branch.

Your direction is the better one, and it removes the completeness problem my patch has: once the spliced processors carry a step that exists in the plan, there is nothing left to enumerate.

One implementation detail that is not obvious from reading the code, in case it saves you time. The generic retag you describe already exists, at ExecutingGraph.cpp:197-198, but it is guarded on !new_proc->getQueryPlanStep(), and the streaming sub-pipeline's processors do already carry a step: buildPartitionReadingPipeline builds a function-local QueryPlan (MergeTreeCommitOrderSequentialSource.cpp:113) and QueryPlan::buildQueryPipeline tags every processor with that local plan's steps (QueryPlan.cpp:266-267). That plan is destroyed when the function returns, so StepWallClockRegistry::find has no entry for those pointers and chassert(clock) fires. So the retag has to be unconditional and at the splice site, in MergeTreeCommitOrderSequentialSource::updatePipeline before update.to_add = std::move(sub_processors) (:476):

for (auto & proc : sub_processors)
    proc->inheritQueryPlanStepFromParent(*this, getQueryPlanStepGroup());

LazyReadReplacingFinalSource.cpp:341-342 does exactly this for its own runtime sub-pipeline. The source itself is tagged with the owning ReadFromMergeTree step by QueryPlan.cpp:266-267, and populateFromPlan does register a clock for that step even when the read sits behind a view (my plan-level walk found it there), so a single unconditional retag covers the direct read, the nested-subquery shapes and the view shapes at once. It also stops those processors from holding dangling step pointers, which are currently used as map keys in AnalyzeStepsStats and printPipeline.

Reproducers, if you want them as acceptance criteria. On a debug build without either fix, these two abort with Logical error: 'clock' and take the server down:

CREATE VIEW v AS SELECT b FROM t STREAM;
EXPLAIN ANALYZE SELECT * FROM v LIMIT 50;

CREATE VIEW pv AS SELECT b FROM t STREAM WHERE b > {lim:UInt64};
EXPLAIN ANALYZE SELECT * FROM pv(lim = 1) LIMIT 50;

The original fuzzer shape is a streaming read reached through WHERE b IN (...), through a CTE, or through INTERSECT ALL inside IN. All of those, plus the plain and EXPLAIN-without-ANALYZE controls, are in tests/queries/0_stateless/04538_explain_analyze_stream_read.sql on this branch. The expectations there are serverError NOT_IMPLEMENTED, so they would need flipping to real result checks for your approach, but the shapes are the coverage. Feel free to take the file.

Two things I measured that neither approach changes, so they are not regressions of yours: a STREAM read used as a scalar subquery or as an IN set blocks identically with no EXPLAIN at all and under plain EXPLAIN, with no clock error, so that is a property of draining a stream rather than this bug. And once it is allowed through, EXPLAIN ANALYZE SELECT * FROM t STREAM without a LIMIT will not terminate, while ... STREAM LIMIT 50 completes.

Do you want me to close #110935 now, or leave it open until your PR is up so the reproducers and the test stay linkable?

@clickhouse-gh

clickhouse-gh Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 82.30% 86.30% +4.00%
Functions 91.70% 92.00% +0.30%
Branches 74.40% 78.40% +4.00%

Changed lines: Changed C/C++ lines covered: 26/29 (89.66%) · Uncovered code

Full report · Diff report

@Fgrtue

Fgrtue commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Okay, CI is green, I'll merge this first and then do another fix, a proper one

@groeneai

Copy link
Copy Markdown
Collaborator Author

Sounds good. I confirmed green independently on c0d3fce: 174/174 check-runs completed, 156 success, 18 skipped, 0 failures (the statusCheckRollup field truncates around 59 runs, so it can misreport this PR as still running).

One pointer for the follow-up rather than a repeat: the mechanism note in my previous comment is why the generic retag at src/Processors/Executors/ExecutingGraph.cpp:197-198 will not reach the streaming sub-pipeline. It is guarded on !getQueryPlanStep(), and those processors already carry a step, a dangling one, because the plan built in buildPartitionReadingPipeline is function-local. So the retag has to be unconditional at the splice site in updatePipeline. All of it still checks out on master 5b8d5034.

Merged via the queue into ClickHouse:master with commit 10332c1 Jul 28, 2026
178 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 28, 2026
pull Bot pushed a commit to infdahai/ClickHouse that referenced this pull request Aug 7, 2026
…utations

The test intermittently timed out on Fast test and Fast test (arm_darwin) with
the client hitting its 60s budget on one of the mutations_sync=2 ALTERs:

  Code: 159. DB::Exception: Timeout exceeded: elapsed 60052.163029 ms,
  maximum: 60000 ms. (TIMEOUT_EXCEEDED)

Those are the two jobs whose tests/config/users.d/limits_fast.yaml pins
max_execution_time: 60, and both run on every PR.

It is a blocking wait rather than a slow run: over 30 days the maximum passing
duration is 7.51s on Fast test and 13.59s on arm_darwin against a 60s cap, the
12-59s band is empty, and both failures sit exactly at the cap.

Root cause. StorageReplicatedMergeTree::mutate creates the mutation znode,
schedules mergeSelectingTask and waits. That task asks
CompactionStatistics::getMaxSourcePartBytesForMutation, whose pool guard at
CompactionStatistics.cpp:155 reads the server-global
BackgroundMergesAndMutationsPoolTask gauge, so it is driven by the other tests
running in parallel rather than by this test. On refusal
StorageReplicatedMergeTree.cpp:4525 returns AttemptStatus::Limited, no
MUTATE_PART entry is created, and waitMutationToFinishOnReplicas just spins.

What turns a transient refusal into a 60s stall is the reschedule block at
:4576-4585. Limited matches neither the divide branch (EntryCreated/NeedRetry)
nor the multiply branch (CannotSelect), but the jitter multiply
new_sleep_ms *= uniform_real_distribution<Float32>(1.f, 1.1f) is unconditional,
so every refusal ratchets the sleep upward. Measured over 20 consecutive
Limited attempts: 5052 -> 15389 ms, mean ratio 1.0607, 3.05x overall, starting
from the merge_selecting_sleep_ms floor rather than the ceiling. And there is
no wake-up for "pool slots freed" - the only merge_selecting_task->schedule()
sites are :4588, :5689, :7152 and :8491, and :8491 (from mutate) has already
fired. So the blocker clears in milliseconds while the assigner sleeps ever
longer, and the client's 60s budget expires first.

Fix: set number_of_free_entries_in_pool_to_execute_mutation = 0 on this test's
table. At 0 the condition max_tasks_count - occupied >= 0 is always true, so
getMaxSourcePartBytesForMutation can never return 0 for pool reasons and the
Limited return becomes unreachable for this table - the mutation is assigned on
the first attempt, with no dependence on how long the backoff sleeps. 0 is
always legal: MergeTreeSettings.cpp:2489 rejects only values greater than
background_pool_size * background_merges_mutations_concurrency_ratio.

This is the same remedy already applied to the same starvation in
03518_alter_logical_race.sh, and 18 other stateless tests set this setting for
the same purpose. I did not pin the sleep ceiling instead: that bounds the
symptom and permanently increases ZooKeeper polling for the table, whereas
removing the refusal changes no interval. The reproduction confirms the
distinction - with the fix the backoff still reaches its 60s ceiling and the
ALTER completes in 0s, so a saturated sleep alone is harmless.

No no-random-* tag is needed: none of the five relevant settings appears among
the 61 MergeTreeSettingsRandomizer keys, so the runner cannot move them.

Verified with a server whose pool is 26 while the setting stays at its default
of 20 and 7 slots are held by unrelated tables, so 26 - 7 = 19 < 20 and the
real guard fires. A/B on one binary, same fixture: without the setting
Code: 159 at 61s, with it success at 0s. Through clickhouse-test with normal
randomization the current version fails and the fixed version passes in 6.6s.
Per-arm log counts scoped to each arm's table: "there are not enough free
threads for mutations" 20 -> 0, "current attempt status: Limited" 20 -> 0,
recheck spins 60 -> 0. --test-runs 50 under sustained pool pressure: 50/50.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110935&sha=bbc9355f428946983e9f5687ed8c6b25e5d14adf&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29
Related: ClickHouse#110935
pull Bot pushed a commit to infdahai/ClickHouse that referenced this pull request Aug 7, 2026
…e_tree

Follow-up to the previous commit on this branch. The one-line test fix
(`number_of_free_entries_in_pool_to_execute_mutation = 0`) is unchanged and
still correct; this commit only fixes how the failure was described, plus the
in-tree comment that carried one of the wrong claims.

Three corrections.

1. The previous commit message quoted a client-side `TIMEOUT_EXCEEDED` exception
as the CI failure. That text is in no artifact of either failing job: it was a
fragment of a truncated `play.clickhouse.com` reply that leaked into a scratch
file during the failure harvest, and the version string embedded in it is the
one that query server reports, not the 26.6.1.1 and 26.8.1.1 of the failing
jobs. What the artifacts do contain is the runner verdict

  [ 2086 / 12705] 02899_restore_parts_replicated_merge_tree:   [ FAIL ] 60.16 sec.
  Reason: Timeout! Killing process group 64263

with the blocking `mutations_sync=2` ALTER named in the process list, and then
server-side, after the kill

  Code: 341. DB::Exception: Mutation is not finished because table shutdown was
  called. It will be done after table restart. (UNFINISHED) (version 26.8.1.1)
  ... TCPHandler: Processed in 59.129 sec.

2. The expiring 60 s budget is not a server-side `max_execution_time`. It is
`clickhouse-test --timeout 60`, the only `--timeout 60` in `ci/`
(`ci/jobs/fast_test.py:378`), enforced by `proc.wait(args.timeout)` at
`tests/clickhouse-test:3516` and the process-group kill at `:695`. That is also
the simpler explanation of why only the two Fast test jobs manifest this: every
other stateless job leaves the 600 s default. `tests/config/users.d/limits_fast.yaml`,
which would pin `max_execution_time: 60`, is never installed at all -
`tests/config/install.sh:273-275` gates its symlink on
`[[ $(is_fast_build) == 1 ]]`, but `is_fast_build` only returns an exit code and
prints nothing, so the substitution is always empty. The failing job's own trace
shows `++ return 1` / `+ [[ '' == 1 ]]`, and `limits_fast` appears nowhere in it.
That substitution bug is a separate concern and is not touched here.

Consistently, the durations compared in the previous message are the runner's
per-test wall clock (`test_duration_ms`), not query durations.

3. The in-tree comment repeated the same `max_execution_time` claim on its last
line, so it was a source-visible defect rather than only a description one. It
is now three lines carrying just the durable reason - isolation from global
merges/mutations pool contention - with literal names in inline code blocks;
the incident-level detail lives in the commit messages and the PR description.

Also corrected: 12 further stateless tests set this setting to 0 for the same
purpose (18 files mention it, but 3 are reference fixtures and 2 of the
remaining tests set an illegal value expecting `BAD_ARGUMENTS`); and CI does not
run at the shipped default of 20 - `tests/config/config.d/merge_tree.xml:4`
overrides it to 8 server-wide, which is the value in the failing job's
`max_tasks_count (32) - occupied (25) < ... (8)` line. The reproduction uses the
stricter default of 20 by shrinking the pool instead.

No behaviour change: the only non-comment edit in the previous commit is
untouched, and the comment-stripped test file is byte-identical to it.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110935&sha=bbc9355f428946983e9f5687ed8c6b25e5d14adf&name_0=PR&name_1=Fast%20test%20%28arm_darwin%29
Related: ClickHouse#110935
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-bugfix Pull request with bugfix, not backported by default 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