Skip to content

Filter benign throwIf-non-zero plain mutation from the upgrade check - #108563

Closed
groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:fix-upgrade-check-plain-mutation-cannot-parse
Closed

groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:fix-upgrade-check-plain-mutation-cannot-parse

Conversation

@groeneai

@groeneai groeneai commented Jun 26, 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

Related: #39174

Filters the benign FUNCTION_THROW_IF_VALUE_IS_NON_ZERO background-mutation <Error> line from the Upgrade check (amd_release) server.log scan.

Test 02597_column_update_tricky_expression_and_replication runs ALTER TABLE test UPDATE d = d + throwIf(1) with mutations_sync=0, then later KILL MUTATION ... LIKE '%throwIf%'. Under upgrade stress the intentionally-failing async mutation can be left behind; the restarted server retries it and logs Value passed to 'throwIf' function is non-zero at <Error>. This is the issue #39174 class (a bad mutation, not a backward incompatibility).

The CANNOT_PARSE_TEXT sibling (Cannot parse string 'x' as UInt64) is already in the allow-list on master (#107985); this adds the throwIf counterpart. The narrow inner-text Value passed to 'throwIf' function is non-zero matches all three emitted line shapes (MutatePlainMergeTreeTask:, its executeStep(), and the MergeTreeBackgroundExecutor wrapper) without masking a genuinely different background-mutation error.

Validated against the real leaked upgrade_error_messages.txt (159 lines from PR #106386, 255 from PR #105991): without the entry every line leaks and the gate fails; with it 0 lines leak; a control LOGICAL_ERROR in the same MutatePlainMergeTreeTask still surfaces.

CI report (throwIf leak, PR #106386): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=106386&sha=767b2cacddb2da81a9698d767ee5fa387995e69b&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29

The Upgrade check "Error message in clickhouse-server.log" sub-check fails
when a background mutation on a non-replicated MergeTree fails to CAST an
intentionally-unconvertible value. Tests like 03047_on_fly_mutations_alters,
03100_lwu_25_update_alters and 04338_on_fly_mutation_read_overwritten_lc_source
do UPDATE v = 'x' then MODIFY COLUMN v UInt64, leaving a part holding 'x' that
a later background mutation cannot parse, logging CANNOT_PARSE_TEXT at <Error>.

This is the same backward-incompatibility-false-positive class as ClickHouse#39174: a
bad mutation that retries after upgrade does not indicate a compatibility
problem. The replicated wrapper MutateFromLogEntryTask is already allow-listed;
this adds the non-replicated counterpart MutatePlainMergeTreeTask.

Filter the narrow inner text "Cannot parse string 'x' as UInt64" rather than
the broad task-component names: it appears in all three emitted lines (the
MutatePlainMergeTreeTask line, its executeStep() line, and the
MergeTreeBackgroundExecutor wrapper line), so one entry covers them all while a
genuinely different plain-mutation error still surfaces.

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. Replayed the exact filter pipe (rg -Fav ... | grep -av ... | grep -Fa "<Error>") over the real 100 leaked <Error> lines from the failing run (PR #108547 head 641aa36ad6b3): without the new entry all 100 remain; with it, 0 remain.
b Root cause explained? The "Error message in clickhouse-server.log" sub-check flags any unfiltered <Error> line. A non-replicated MergeTree part holds an intentionally-unconvertible string 'x' (test does UPDATE v='x' then MODIFY COLUMN v UInt64); after upgrade a background mutation CASTs it and fails with CANNOT_PARSE_TEXT, emitting <Error> from MutatePlainMergeTreeTask. This is the #39174 false-positive class (bad mutation != backward incompatibility).
c Fix matches root cause? Yes. It allow-lists the exact benign inner text, mirroring the already-present replicated counterpart MutateFromLogEntryTask and the existing Cannot parse string 'Hello'/'a'/'b' entries. No assertion is weakened.
d Test intent preserved / new tests added? Yes. The narrow inner-text filter Cannot parse string 'x' as UInt64 masks ONLY this benign value; a genuinely different plain-mutation error (e.g. a LOGICAL_ERROR from MutatePlainMergeTreeTask) still surfaces. Verified with a negative control line that must (and does) remain.
e Both directions demonstrated? Yes. Against the real CI log lines: 100/100 leak without the fix, 0/100 leak with it; the control non-'x' error line is never masked.
f Fix is general across code paths? N/A (CI log-noise allow-list fix, not a code bug). The one inner-text entry already covers all three emitted line shapes (MutatePlainMergeTreeTask:, executeStep(), MergeTreeBackgroundExecutor).
g Fix generalizes across inputs? N/A (CI allow-list fix, not a code bug).
h Backward compatible? N/A (test-harness script only; no setting/format/validation change).
i Invariants and contracts preserved? N/A (no engine code touched). The rg -Fav fixed-string semantics and the secondary grep pipe are unchanged; bash syntax re-checked (bash -n).

Session id: cron:clickhouse-worker-slot-0:20260626-012400

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @fm4v — could you review? Same upgrade_runner.sh allow-list pattern as #96747 / #101576: adds the non-replicated MutatePlainMergeTreeTask counterpart of the already-filtered MutateFromLogEntryTask, masking only the benign Cannot parse string 'x' as UInt64 (CANNOT_PARSE_TEXT) from stress-leftover bad mutations (the #39174 class).

@nikitamikhaylov nikitamikhaylov added the can be tested Allows running workflows for external contributors label Jun 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ddba4c9]

Summary: ⏳

job_name test_name status info comment
Stress test (amd_asan_ubsan) FAIL
Hung check failed, possible deadlock found FAIL cidb, issue

AI Review

Summary

This PR adds a narrow fixed-string allow-list entry for the upgrade check log scan, covering the benign Cannot parse string 'x' as UInt64 CANNOT_PARSE_TEXT lines emitted by non-replicated MergeTree mutation retries after upgrade. The change matches the linked failure mode: replaying the current filter over the raw upgrade log leaves no leaked <Error> lines, while removing the new pattern leaves the MutatePlainMergeTreeTask / MergeTreeBackgroundExecutor lines. I found no blockers or major issues.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 26, 2026
The Upgrade check (amd_release) server.log scan fails on benign
background-mutation errors left behind by 02597_column_update_tricky_expression_and_replication:
its 'ALTER TABLE test UPDATE d = d + throwIf(1)' (mutations_sync=0)
mutation is intentionally-failing and is killed later in the test, but
the upgraded server retries it on restart and logs FUNCTION_THROW_IF_VALUE_IS_NON_ZERO
at <Error>. This is the same ClickHouse#39174 stress-leftover-mutation class as the
adjacent CANNOT_PARSE 'x'/'Hello' allow-list entries.

Add a narrow inner-text 'Value passed to throwIf function is non-zero'
entry to the rg -Fav allow-list. It covers all three emitted line shapes
(MutatePlainMergeTreeTask, its executeStep(), and the
MergeTreeBackgroundExecutor wrapper) while a genuinely different
background-mutation error still surfaces.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Jun 26, 2026
@groeneai groeneai changed the title Filter benign plain-mutation CANNOT_PARSE_TEXT from upgrade check Filter benign plain-mutation CANNOT_PARSE_TEXT and throwIf errors from upgrade check Jun 26, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Batched a second allow-list entry into this PR (commit 46c8acf): Value passed to 'throwIf' function is non-zero (FUNCTION_THROW_IF_VALUE_IS_NON_ZERO). Same #39174 stress-leftover-mutation class as the CANNOT_PARSE entry, same file, same one-line rg -Fav mechanism, so it belongs in this PR rather than a separate tiny one.

Source: 02597_column_update_tricky_expression_and_replication does ALTER TABLE test UPDATE d = d + throwIf(1) (mutations_sync=0), an intentionally-failing mutation killed later via KILL MUTATION ... LIKE '%throwIf%'; the upgraded server retries it on restart and logs the error at <Error>.

Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Replayed the script's exact `rg -Fav
b Root cause explained? The upgrade-check scans the post-upgrade server log for unfiltered <Error> lines. 02597_... creates a d + throwIf(1) async mutation that is meant to fail and be killed; under upgrade-stress the mutation is left behind and the restarted server retries it, logging FUNCTION_THROW_IF_VALUE_IS_NON_ZERO. This is benign leftover-mutation noise (#39174), not a backward-incompatibility.
c Fix matches root cause? Yes. Adds a narrow inner-text allow-list entry for exactly that benign message, mirroring the established #39174/#101576 filter pattern for the sibling CANNOT_PARSE variant.
d Test intent preserved / new tests added? Yes. The allow-list is intentionally narrow (inner text only); a genuinely different plain-mutation error (verified with a control LOGICAL_ERROR line) is NOT masked and still fails the check. No test weakened.
e Both directions demonstrated? Yes — see (a): 159/159 leak without, 0/159 with, control LOGICAL_ERROR line still surfaces.
f Fix is general across code paths? Yes. The single inner-text entry covers all three emitted line shapes (MutatePlainMergeTreeTask:, its executeStep(), and the MergeTreeBackgroundExecutor wrapper — 53 of each in the real log), the same as the CANNOT_PARSE sibling.
g Fix generalizes across inputs? N/A (CI allow-list filter, not a code bug).
h Backward compatible? N/A (CI test-script change only).
i Invariants and contracts preserved? N/A (CI test-script change only; no engine/data-structure/concurrency contract touched).

Session id: cron:clickhouse-worker-slot-1:20260626-145600

@groeneai

Copy link
Copy Markdown
Collaborator Author

Closing in favor of #108651, which now covers both benign #39174 background-mutation error classes (CANNOT_PARSE_TEXT and FUNCTION_THROW_IF_VALUE_IS_NON_ZERO) by error CLASS on the background-mutation executor, rather than per-literal entries. That approach was reviewed and approved on #108651; the throwIf coverage from this PR is folded in there.

@groeneai groeneai closed this Jun 29, 2026
@groeneai groeneai changed the title Filter benign plain-mutation CANNOT_PARSE_TEXT and throwIf errors from upgrade check Filter benign throwIf-non-zero plain mutation from the upgrade check Jun 29, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

PR scope slimmed: master now carries the Cannot parse string 'x' as UInt64 parse entry (via #107985, merged 2026-06-29), and the parse-error CLASS is covered by approved PR #108651. This PR is now reduced to the throwIf entry only, which neither master nor #108651 covers (it is FUNCTION_THROW_IF_VALUE_IS_NON_ZERO, not a parse error). Revalidated below.

Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Test 02597_column_update_tricky_expression_and_replication runs ALTER TABLE test UPDATE d = d + throwIf(1) with mutations_sync=0; under upgrade stress the async mutation is left behind and the restarted server retries it, deterministically logging Value passed to 'throwIf' function is non-zero (FUNCTION_THROW_IF_VALUE_IS_NON_ZERO) at <Error>. Real leaked sets: 159 lines (PR #106386), 255 lines (PR #105991), all this one pattern.
b Root cause explained? The Upgrade check greps server.log for non-allowlisted <Error> lines. The throwIf(1) mutation is intentionally-failing test data (issue #39174 class: a bad mutation is not a backward incompatibility). It is killed later in the test, but upgrade-stress leaves it pending; the restarted server retries it on every background-mutation attempt and leaks the <Error> line. Not in the allow-list yet.
c Fix matches root cause? Yes. Adds the exact inner text Value passed to 'throwIf' function is non-zero to the existing #39174 rg -Fav allow-list block, next to the sibling Cannot parse string 'x' as UInt64 entry.
d Test intent preserved / new tests added? Yes. No test is changed or weakened. This is a CI log-noise filter only. The literal is a full error message (no fuzzer-variable part), so it cannot mask an unrelated error.
e Both directions demonstrated? Yes. Against the real upgrade_error_messages.txt: without the entry 159/159 (PR #106386) and 255/255 (PR #105991) <Error> lines leak and the gate fails; with the rg -Fav entry 0 lines leak and the gate passes.
f Fix is general across code paths? Yes for scope. The throwIf error is emitted on three line shapes (MutatePlainMergeTreeTask:, its executeStep(), the MergeTreeBackgroundExecutor wrapper); the single inner-text entry covers all three. The replicated MutateFromLogEntryTask counterpart is already filtered separately.
g Fix generalizes across inputs? N/A (CI allow-list entry, not a code bug). The throwIf message is constant regardless of mutation expression; broadening it would risk masking real errors.
h Backward compatible? N/A (CI test-script change only; no product behavior, settings, or formats touched).
i Invariants/contracts preserved? Yes. Control test confirmed the narrow entry drops only the throwIf line; a LOGICAL_ERROR in the same MutatePlainMergeTreeTask and an unrelated real bug both still surface.

Session id: cron:clickhouse-worker-slot-7:20260629-113100

@groeneai

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #108651 (this supersedes my earlier "scope slimmed" comment, which was based on a stale read of #108651).

#108651 (alexey-milovidov-approved) now suppresses both benign issue-#39174 background-mutation classes by error CLASS on the background-mutation executor:

grep -avE -e "(MutatePlainMergeTreeTask|MutateFromLogEntryTask|MergeTreeBackgroundExecutor).*(Cannot parse string .* as .*CANNOT_PARSE_TEXT|FUNCTION_THROW_IF_VALUE_IS_NON_ZERO)"

That covers the Value passed to 'throwIf' function is non-zero (FUNCTION_THROW_IF_VALUE_IS_NON_ZERO) lines this PR added, the Cannot parse string '...' as <Type> (CANNOT_PARSE_TEXT) parse class, and any future fuzzer-generated literal/type, without masking a genuine LOGICAL_ERROR in the same task.

Verified against the real leaked upgrade_error_messages.txt: #108651's combined class regex drops 159/159 throwIf lines (PR #106386) and 255/255 (PR #105991), and 0 of a control LOGICAL_ERROR + unrelated bug. As alexey noted on #108651, the Stress test fuzzes arbitrary literals before the upgrade check, so a per-literal/per-class allow-list of fixed strings can never be complete; the single class match is the robust fix. This per-string PR is redundant.

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 manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants