Skip to content

Allowlist the 03640 fixture's failed mutation in the upgrade log scan - #120881

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:allowlist-03640-failed-mutation-in-upgrade-check
Sep 19, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:allowlist-03640-failed-mutation-in-upgrade-check

Conversation

@groeneai

@groeneai groeneai commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

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 into CHANGELOG.md):

...

Description

Upgrade check reds on Error message in clickhouse-server.log while every other sub-result of the job is OK, so the job gives the carrying PR no signal at all. Two runs seen so far, both bystanders: #120706 and #117667. In each, 100% of the leaked lines (318/318 and 345/345) come from one test fixture.

Root cause: the job replays the previous release's frozen suite, which contains 03640_multiple_mutations_with_error_with_rewrite_parts. That test deliberately starts a mutation that can never succeed (DELETE WHERE c0.size = 'b' compares a UInt64 subcolumn to a string, so it raises TYPE_MISMATCH on every retry) and kills it at the end of the file. The stress runner injects memory_tracker_fault_probability for one worker in five; on both runs the fault hit an earlier statement, the client stopped the file before its KILL MUTATION, and --upgrade-check implies --fake-drop so the table survived. The upgraded server then resumed that mutation and retried it for the whole post-upgrade window, and its asserted error reached a scan with no entry for it.

So I add one scoped entry for that message. Nothing else emits it: 03640 is the only test that mutates on c0.size, and I verified the pattern matches exactly those 318 and 345 lines out of 116k real log lines, with Code: 49, UInt32, c1.size, notEquals, 'c' and the real MutatePlainMergeTreeTask error that this same scan surfaced in #118499 all still visible. Precedent in this same file: 16058d92c542d, c06040ab97f9c, a271dbefd7977.

One alternative I did not take, for the CI owners to weigh: killing already-failed mutations on the old server before the upgrade would retire this class instead of adding a per-test entry.

No related open issue found.


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

groeneai and others added 2 commits September 18, 2026 08:39
`03640_multiple_mutations_with_error_with_rewrite_parts` deliberately
starts a mutation that can never succeed: `DELETE WHERE c0.size = 'b'`
compares a `UInt64` subcolumn to a string, so every retry raises
`TYPE_MISMATCH`. The test asserts the resulting `UNFINISHED` and ends
with a correctly scoped `KILL MUTATION`, so in an ordinary stateless run
the mutation is dead before anything can observe its retries.

The upgrade job replays it, and there the cleanup does not always run.
`upgrade_runner.sh` clones the previous release by tag and runs that
frozen suite, so the copy under test is the one inside
`v26.8.6.5-lts`. `stress.py` gives one stress worker in five
`memory_tracker_fault_probability=0.05` for the whole suite, and on both
carrier runs the fault struck the test's `ALTER TABLE t0 REWRITE PARTS`
with `Code: 241 ... fault injected` where `UNFINISHED` was asserted. An
unexpected error stops the rest of the `.sql` file, so the
`KILL MUTATION` never runs, and `--upgrade-check` implies `--fake-drop`,
so no `DROP` removes the table either. The new server loads the pending
mutation and retries it with exponential backoff for the whole
post-upgrade window, three `<Error>` lines per attempt, all of them
tagged with the new version. Nothing else in either job failed, so the
carrying PR got no signal at all from it.

The log scan comes from the tree under test, so an entry added here
takes effect immediately; a fix to the test itself cannot reach this job
until a release carrying it becomes the previous release, and never for
the tag already frozen.

The entry matches the message rather than the emitting component. The
error leaks in three shapes (`MutatePlainMergeTreeTask:`, the
`executeStep()` line, and the wrapping `MergeTreeBackgroundExecutor:`
line, in equal numbers), which one shared substring covers in a single
entry, whereas excluding `MutatePlainMergeTreeTask` as a class would
have hidden ClickHouse#118499, a real analyzer defect that surfaced only through
this same scan. The literal, the target type and the expression are all
kept: `03640` is the only test in the suite that mutates on `c0.size`,
so together they cannot mask anything else. The DAG argument index is
left out because it varies between runs.

Measured by extracting this file's scan pipeline mechanically and
replaying it over the pre-filter logs of both carrier runs. Before the
entry the replay reproduces each job's own `upgrade_error_messages.txt`
byte for byte, 318 lines out of 72253 and 345 out of 44290, and all of
them are this one fixture. After it both replays are empty, and `comm`
confirms no line outside the fixture's own changed state. The pattern's
hit count over each full log equals the leaked count, so it matches
nothing else anywhere. Six controls built by substituting one field of a
real leaked line all still surface after the entry (`'c'` for the
literal, `UInt32` for the target type, `c1.size` for the column,
`notEquals` for the function, `Code: 49 LOGICAL_ERROR` for the severity,
and the unmodified line as the positive case), as does a reconstruction
of the ClickHouse#118499 line.

Co-Authored-By: Claude Opus 5 <[email protected]>
The entry matched from `Cannot convert string 'b'` onwards, so it began
after the exception code and suppressed the identical message text under
any other code as well. A line that differs from the real leaked one only
in its code and exception name was filtered out, which is one class of
real regression the scan exists to catch.

Prefixing the pattern with `Code: 53. DB::Exception: ` costs nothing.
All three shapes the error leaks in carry that prefix contiguously
immediately before the message, including the wrapping
`MergeTreeBackgroundExecutor: Exception while executing background task
{...}: ` line, so coverage over the two real carrier logs is unchanged at
318 of 318 and 345 of 345 while the scope is strictly narrower. It stays
one fixed string in the same pipe, 125 characters against a file maximum
of 235.

`Code: 53` and `(TYPE_MISMATCH)` encode the same fact, so moving the
entry to the regex chain to match the code would buy no further
narrowing; the fixed-string prefix is the cheaper equally tight form.

The control matrix gains the axis it was missing. Its previous
`Code: 49 LOGICAL_ERROR` control replaced the message as well as the
code, so it never contained the matched substring and demonstrated
nothing about a code-only mutation; the earlier commit message overstates
it as covering the severity field. The new control takes a real leaked
line and changes only `Code: 53` to `Code: 49` and `(TYPE_MISMATCH)` to
`(LOGICAL_ERROR)`, leaving the message byte-identical. Run through the
pipeline with no entry it survives, with the previous entry it is
removed, and with this one it survives, which is what makes it a proof of
this change rather than an accompaniment to it. The seven existing
controls keep their verdicts, the replay over both carrier logs still
empties, and `comm` still shows no line outside the fixture changing
state.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 18, 2026
@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; 2 findings over 2 rounds, 0 in the
final round; bounded: 1 full pass + up to 5 fix rounds + a delta recheck each).

# Sev Finding Verdict Evidence / action
1 ⚠️ The exclusion started after the exception code, so the same message text under a different code would have been suppressed too (tests/docker_scripts/upgrade_runner.sh:584) AGREE, fixed @ fa50f83 Pinned Code: 53. DB::Exception: into the pattern: coverage unchanged at 318/318 and 345/345 on the two real job logs, scope strictly tighter. Added the control this axis was missing: the real line with only its code changed to 49, which the old pattern removed and the new one leaves visible.
2 💡 The description called #118499 "the real open defect"; it is an open fix PR, not a defect report AGREE, fixed Corrected in the description. The substance held: that PR's body records a MutatePlainMergeTreeTask: Code: 47 UNKNOWN_IDENTIFIER burst tripping this same log-scan leaf.

Round 2: 0 findings from the gate and 0 from my own cold pass, with the coverage claim re-derived from
the jobs' own artifacts (the entry hits exactly 345 of the 44,290 pre-filter log lines, i.e. the leaked
set and nothing beyond it). Pinning the code also makes the entry fail closed: were this message ever
raised under a different code, the line would reappear and fail the job rather than be hidden silently.

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-review-slot-9:20260918-163300

@groeneai groeneai added the groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect label Sep 18, 2026
@clickhouse-gh clickhouse-gh Bot closed this Sep 18, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 18, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 18, 2026
@groeneai
groeneai requested a review from fm4v September 18, 2026 17:07
@clickhouse-gh

clickhouse-gh Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fa50f83]

Summary: ✅


AI Review

Summary

This PR narrows the Upgrade check log scrub by allowlisting one known TYPE_MISMATCH emitted by the frozen 03640_multiple_mutations_with_error_with_rewrite_parts fixture after restart. I did not find an unresolved masking risk in the current head: the exact fixed string is unique to that test in the checked tree, it matches the leaked lines in both carrier Upgrade check logs, and the added Code: 53 prefix avoids the broader message-only suppression that the first revision had.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Sep 18, 2026
@alexey-milovidov alexey-milovidov self-assigned this Sep 19, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 19, 2026
Merged via the queue into ClickHouse:master with commit b3b4bef Sep 19, 2026
176 of 349 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 19, 2026
alexey-milovidov added a commit that referenced this pull request Sep 19, 2026
Conflict in `tests/docker_scripts/upgrade_runner.sh`: #120881 landed on
`master` while this branch was open and added an allow-list entry for the
`03640_multiple_mutations_with_error_with_rewrite_parts` mutation
(`Code: 53. DB::Exception: Cannot convert string 'b' to type UInt64: while
executing 'FUNCTION equals(c0.size`) in the same two hunks this branch
deletes.

Resolved in favour of this branch, so the new entry is removed as well.
That mutation is the very case measured in this pull request: with the
allow list of `master` and the mutations left alive it is the 48 `<Error>`
lines that still leak, and killing the mutations before the upgrade brings
them to zero without any entry. Keeping the entry would leave a dead
pattern in a list the branch documents as deliberately free of mutation
errors.

Related: #120881
pull Bot pushed a commit to admariner/ClickHouse that referenced this pull request Sep 20, 2026
The post-upgrade `<Error>` log scan of `Upgrade check` keeps acquiring new
allow-list entries for the same thing: a test deliberately starts a mutation
that can never succeed - `toUInt32` of a non-numeric string, `throwIf(1)`, a
type mismatch, a `DELETE WHERE` on a virtual column - and kills it at the end
of the test file, but the stress runner regularly stops a test file before its
last statement, and `--upgrade-check` implies `--fake-drop`, so the table and
its broken mutation survive. The upgraded server resumes the mutation, retries
it for the whole post-upgrade window, and its error reaches the scan.

Kill the mutations instead, on the old server, between the stress phase and the
upgrade. A mutation an interrupted stress run left behind is test garbage, not
a backward-compatibility signal, and the scan had to suppress the mutation
error messages wholesale anyway. With nothing left for the upgraded server to
resume, the whole class is retired at once and the scan gets stricter: a
mutation error after the upgrade is now an anomaly rather than an expected
message to be filtered out.

So the entries that only ever masked a retried broken mutation are removed:
the `Cannot parse string ... as UInt32/UInt64/Int8` list, `MutateFromLogEntryTask`,
`Value passed to 'throwIf' function is non-zero`, `Unexpected const virtual
column: _table` and `Prevent converting Nullable type to non-Nullable type
inside mutation`. `Code: 236 ... Cancelled mutating parts` stays: the new
server's own shutdown emits it.

The list of mutations found before they are killed is written to
`unfinished_mutations.txt` in the job output, so a mutation that could not be
killed can be attributed. `KILL MUTATION` throws for a read-only table and
`set -e` would abort the job, so the mutations are killed one at a time rather
than by a single statement that one such table would stop; each is addressed by
a hash of its key, because database and table names are arbitrary strings that
must not be carried through the shell.

Verified against a local server holding five broken mutations of these shapes
(plain `MergeTree`, `ReplicatedMergeTree`, a table name containing a quote, and
a valid mutation chained behind a broken one). Over 60 seconds after a restart:

    allow list   mutations    leaked `<Error>` lines
    current      alive        48
    this change  alive        224
    current      killed       0
    this change  killed       0

The 48 lines the current allow list still leaks are exactly the
`03640_multiple_mutations_with_error_with_rewrite_parts` `TYPE_MISMATCH`
mutation that ClickHouse#120881 adds an entry for; this change removes them without one,
so it supersedes that pull request.

Related: ClickHouse#120881
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 comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect manual approve Manual approve required to run CI 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.

3 participants