Repository navigation
Allowlist the 03640 fixture's failed mutation in the upgrade log scan - #120881
alexey-milovidov merged 2 commits into
Conversation
`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]>
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
Round 2: 0 findings from the gate and 0 from my own cold pass, with the coverage claim re-derived from Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20260918-163300 |
|
Workflow [PR], commit [fa50f83] Summary: ✅ AI ReviewSummaryThis PR narrows the Final VerdictStatus: ✅ Approve |
b3b4bef
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
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
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Upgrade checkreds onError message in clickhouse-server.logwhile every other sub-result of the job isOK, 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 aUInt64subcolumn to a string, so it raisesTYPE_MISMATCHon every retry) and kills it at the end of the file. The stress runner injectsmemory_tracker_fault_probabilityfor one worker in five; on both runs the fault hit an earlier statement, the client stopped the file before itsKILL MUTATION, and--upgrade-checkimplies--fake-dropso 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:
03640is the only test that mutates onc0.size, and I verified the pattern matches exactly those 318 and 345 lines out of 116k real log lines, withCode: 49,UInt32,c1.size,notEquals,'c'and the realMutatePlainMergeTreeTaskerror 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]