Skip to content

Allow-list benign throwIf mutation retry noise in upgrade check - #109009

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:fix-upgrade-check-throwif-mutation-log-noise
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:fix-upgrade-check-throwif-mutation-log-noise

Conversation

@groeneai

@groeneai groeneai commented Jul 1, 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

Requested by @ alexey-milovidov on #108957 (CI triage): own this upgrade-check flake in a separate PR.

The upgrade check's "Error message in clickhouse-server.log" assertion (Upgrade check (amd_release)) has been failing across many unrelated PRs since ~2026-06-26 with FUNCTION_THROW_IF_VALUE_IS_NON_ZERO (code 395) at <Error> from a background mutation. CIDB: 40 failures / 39 distinct PRs / 0 on master in the last 60 days, onset 2026-06-26.

Root cause: test 04341_broken_mutation_part_log_flush runs ALTER TABLE t_failed_mutation_part_log UPDATE x = x + throwIf(1) WHERE 1, which fails a plain-MergeTree mutation on purpose (to exercise the failed-MutatePart part_log path added in 189f802). This is a new member of the #39174 family: if the intentionally-broken mutation is still queued when the server restarts for the upgrade step, it is replayed and logs code 395 at <Error>, tripping the "no error messages in server log" check.

Fix: add two allow-list regexes to the secondary grep pipe in tests/docker_scripts/upgrade_runner.sh, matching the two <Error> line shapes this produces:

  • MutatePlainMergeTreeTask.*FUNCTION_THROW_IF_VALUE_IS_NON_ZERO (the task line and its executeStep() line)
  • MergeTreeBackgroundExecutor: Exception while executing background task.*FUNCTION_THROW_IF_VALUE_IS_NON_ZERO (the background-executor wrapper line)

Each regex requires the mutation-executor context AND the code-395 signature together. Code 395 is by definition a user throwIf expression evaluating non-zero (an expected error, never a server malfunction), so a genuine upgrade regression surfaces as a different code and is not masked. This mirrors the existing CANNOT_PARSE_TEXT exclusions for the same #39174 family (00834_kill_mutation, 01414_mutations_and_errors_zookeeper, 04338_on_fly_mutation_read_overwritten_lc_source).

Validation: the two regexes were run against the exact <Error> log lines captured from real CI failures plus decoy lines (a genuine Application/LOGICAL_ERROR regression, a real code-999 MutatePlainMergeTreeTask error, and a real MEMORY_LIMIT_EXCEEDED background-task error). Without the fix all benign throwIf lines leak (check fails, as today); with the fix all benign throwIf lines are filtered while every decoy survives.

CI report example: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107566&sha=ff5b03a6889ac814851c78b9ceca8ee83e8977d5&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29

Test 04341_broken_mutation_part_log_flush intentionally fails a plain
MergeTree mutation via UPDATE x = x + throwIf(1). If the broken mutation
is still queued when the server restarts for the upgrade step, it is
replayed and logs FUNCTION_THROW_IF_VALUE_IS_NON_ZERO (code 395) at
<Error>, tripping the upgrade check's server.log assertion. This is a
new member of the ClickHouse#39174 family (intentionally-broken mutations retry
after upgrade). Add two allow-list regexes requiring the mutation
executor context (MutatePlainMergeTreeTask / MergeTreeBackgroundExecutor
background task) AND the code-395 signature together, so genuine
regressions (which surface as a different code) are not masked.

CIDB: 40 failures / 39 distinct PRs / 0 on master in 60 days, onset
2026-06-26.

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

groeneai commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The failing <Error> lines were captured verbatim from 40 real CI runs (CIDB); running them through the exact edited grep -av pipe deterministically reproduces the check FAIL without the fix and PASS with it.
b Root cause explained? Test 04341_broken_mutation_part_log_flush runs ALTER ... UPDATE x = x + throwIf(1) → a plain-MergeTree mutation fails on purpose (code 395). Under upgrade-stress the broken mutation can still be queued at the restart; the new server replays it and logs code 395 at <Error> → trips the "no error messages in server.log" upgrade assertion. New member of the #39174 family.
c Fix matches root cause? Yes. The fix allow-lists exactly that benign retry line in the same secondary-pipe mechanism already used for the #39174 CANNOT_PARSE_TEXT siblings — it does not touch the test or the engine.
d Test intent preserved / new tests added? Preserved. The assertion still catches every non-395 error. Code 395 is by definition a user throwIf evaluating non-zero (expected), so a genuine upgrade regression surfaces as a different code and is still reported. This is a CI-harness allow-list change (no ClickHouse code, no unit test to add).
e Both directions demonstrated? Yes. Fixture (4 real benign throwIf lines + 3 decoys: a genuine Application/LOGICAL_ERROR, a real code-999 MutatePlainMergeTreeTask, a real MEMORY_LIMIT_EXCEEDED background task): without fix all 4 benign leak (FAIL); with fix all 4 filtered, all 3 decoys survive (PASS).
f Fix is general across code paths? Yes. Two regexes cover both <Error> line shapes this produces: MutatePlainMergeTreeTask (task line + executeStep() line) and the MergeTreeBackgroundExecutor: Exception while executing background task wrapper. CIDB confirms all 40/40 failures use MutatePlainMergeTreeTask (0 replicated MutateFromLogEntryTask, which is already allow-listed).
g Fix generalizes across inputs? Each regex requires the mutation-executor context AND the FUNCTION_THROW_IF_VALUE_IS_NON_ZERO code together, so it does not over-match. CIDB: all 40 throwIf-395 failures carry the exact plus(x, throwIf expression from 04341; zero throwIf-395 failures use any other expression. No real regression is masked.
h Backward compatible? N/A (CI-harness allow-list change; no server behavior, setting, or on-disk/wire format changes).
i Invariants and contracts preserved? Yes. The allow-list narrows only benign code-395 mutation-executor lines; the pipe's contract ("report any unexpected <Error>") is preserved for every other error code and component.

Session id: cron:clickhouse-worker-slot-3:20260701-031000

@groeneai

groeneai commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

cc @maxknv @leshikus — could you review this? It adds two allow-list regexes to tests/docker_scripts/upgrade_runner.sh for the benign FUNCTION_THROW_IF_VALUE_IS_NON_ZERO mutation-retry line that 04341_broken_mutation_part_log_flush leaves in server.log during the upgrade restart (40 failures / 39 unrelated PRs / 0 master in 60d). Each regex requires the mutation-executor context AND code 395 together, so real regressions are not masked.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jul 1, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8cf1f77]

Summary: ✅


AI Review

Summary

This PR adds two upgrade-check allow-list patterns for intentionally failed plain-MergeTree mutation retries from 04341_broken_mutation_part_log_flush. I verified the referenced CI failure log through the updated filter and found no remaining unexpected <Error> lines, and the PR metadata matches a CI-only harness fix.

Final Verdict

Status: ✅ Approve

@groeneai

groeneai commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 8cf1f77

CI fully finished on this head (Finish Workflow + Mergeable Check pass, mergeStateStatus CLEAN). Zero red checks — every check is pass or skipping, including Upgrade check (amd_release) (the target of this fix), all Stress lanes, Style, and CH Inc sync.

Check / test Reason Owner / fixing PR
(none) — All checks pass; no failures to own

Session id: cron:our-pr-ci-monitor:20260701-070000

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 1, 2026
03279_database_backup_database_disk_engine creates a
..._inner_backup_database database (ENGINE = Backup) and drops it, but the
upgrade check runs the client with --fake-drop (DROP queries are ignored),
so the database survives into the upgrade restart. When the upgrade run
randomly enables --encrypted-storage, the backed-up parts are encrypted; on
restart the Backup engine reads them through DiskBackup (a non-encrypted
virtual disk), so BackupImpl rejects the encrypted files with
CANNOT_RESTORE_TO_NONENCRYPTED_DISK (Code 697), logged as a broken part plus
a follow-up 'Detaching broken part ... backward incompatibility' line.

This is expected: an encrypted backup stores already-encrypted bytes and no
disk key, so it can only be read back on an encrypted disk. Allow-listed with
two narrow regexes that require the _inner_backup_database context together
with the specific message, so other broken-part errors are not masked.

The co-occurring FUNCTION_THROW_IF_VALUE_IS_NON_ZERO mutation-retry noise on
the same check is handled separately in ClickHouse#109009.

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

groeneai commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #108651 ("Match benign mutation parse errors by class in the Upgrade check"), which is already approved by @ alexey-milovidov and MERGEABLE.

#108651 replaces the per-literal Cannot parse string ... allow-list with an error-CLASS regex that folds in this exact FUNCTION_THROW_IF_VALUE_IS_NON_ZERO signature:

(MutatePlainMergeTreeTask|MutateFromLogEntryTask|MergeTreeBackgroundExecutor).*(Cannot parse string .* as .*CANNOT_PARSE_TEXT|FUNCTION_THROW_IF_VALUE_IS_NON_ZERO)

The two regexes here (MutatePlainMergeTreeTask.*FUNCTION_THROW_IF_VALUE_IS_NON_ZERO and MergeTreeBackgroundExecutor: ...background task.*FUNCTION_THROW_IF_VALUE_IS_NON_ZERO) are a strict subset of that class regex, and both PRs edit the same lines of tests/docker_scripts/upgrade_runner.sh, so keeping both open would conflict on merge. #108651 fully covers this flake (the 04341_broken_mutation_part_log_flush / t_failed_mutation_part_log background-mutation throwIf noise, #39174 family) plus the CANNOT_PARSE_TEXT members. Consolidating onto #108651.

@groeneai groeneai closed this Jul 1, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 2, 2026
03279_database_backup_database_disk_engine creates a
..._inner_backup_database database (ENGINE = Backup) and drops it, but the
upgrade check runs the client with --fake-drop (DROP queries are ignored),
so the database survives into the upgrade restart. When the upgrade run
randomly enables --encrypted-storage, the backed-up parts are encrypted; on
restart the Backup engine reads them through DiskBackup (a non-encrypted
virtual disk), so BackupImpl rejects the encrypted files with
CANNOT_RESTORE_TO_NONENCRYPTED_DISK (Code 697), logged as a broken part plus
a follow-up 'Detaching broken part ... backward incompatibility' line.

This is expected: an encrypted backup stores already-encrypted bytes and no
disk key, so it can only be read back on an encrypted disk. Allow-listed with
two narrow regexes that require the _inner_backup_database context together
with the specific message, so other broken-part errors are not masked.

The co-occurring FUNCTION_THROW_IF_VALUE_IS_NON_ZERO mutation-retry noise on
the same check is handled separately in ClickHouse#109009.

Co-Authored-By: Claude Opus 4.8 <[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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants