Skip to content

Allowlist the expected 04510 mutation error in the upgrade check - #117218

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:allowlist-04510-table-virtual-column-upgrade-check
Sep 2, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:allowlist-04510-table-virtual-column-upgrade-check

Conversation

@groeneai

@groeneai groeneai commented Aug 31, 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):

Stop the upgrade check from failing on the mutation error that 04510_mutation_query_plan_only_virtual_columns raises on purpose.

Description

Upgrade check (*) reds on the job row Error message in clickhouse-server.log because of an error a test asserts on purpose.

04510_mutation_query_plan_only_virtual_columns runs ALTER TABLE ... DELETE WHERE _table != '' -- { serverError UNFINISHED }. _table comes from the local storage id, which a mutation cannot materialize, so the per-part read reaches getFieldForConstVirtualColumn and throws NO_SUCH_COLUMN_IN_TABLE. It happens in a background MutatePlainMergeTreeTask, so the client sees only the asserted UNFINISHED and the test passes, while Code: 16 goes to the log at <Error> level.

The upgrade run then replays it: upgrade_runner.sh runs the previous release's test tree, and --upgrade-check implies --fake-drop, so the table and its failed mutation survive the test's own DROP. The new server loads the pending mutation and retries it, 84 times in the 60s observation window, three <Error> lines each. All 252 lines reach upgrade_error_messages.txt and red the job. This is the FIXME #39174 class the surrounding comment block already documents: an intentionally-broken test mutation retried after upgrade.

I validated by replaying the failing run's real 140435-line pre-filter log through the real scan pipeline. Unmodified, it reproduces CI's upgrade_error_messages.txt byte-identically (252 lines); with the entry, 0 survive and the job reports No Error messages after server upgrade. Exactly those 252 lines go, nothing else.

The column name and the MergeTreeSequentialSource read path are both in the pattern, so _sample_factor from a mutation (that one is #78465, the bug 04510 guards) and the query-path variant still surface; dropping either from the pattern masks controls that must stay visible. _database is deliberately left unmasked: no test mutates on it today, so a first occurrence should be reviewed rather than pre-suppressed.

Related: #39174. 04510 came from #109813. Sibling allowlist PR on the same file with a different root cause: #113983.

Failing run: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113857&sha=bde3aeeaea976d74892ad3d48ac2b7c200629701&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29


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

Version info

  • Merged into: 26.9.1.540 (included in 26.9 and later)

`04510_mutation_query_plan_only_virtual_columns` asserts that
`ALTER TABLE ... DELETE WHERE _table != ''` fails: `_table` comes from the local
storage id, which a mutation cannot materialize, so the per-part read reaches
`getFieldForConstVirtualColumn` and throws `NO_SUCH_COLUMN_IN_TABLE`. The throw
happens in a background `MutatePlainMergeTreeTask`, so the client receives only
the asserted `UNFINISHED` and the functional test passes, while `Code: 16` is
written to the server log at `<Error>` level.

The upgrade job replays it. `upgrade_runner.sh` runs the previous release's test
tree, and `--upgrade-check` implies `--fake-drop`, so the table and its failed
mutation survive the test's own `DROP`. The new server loads the pending
mutation and retries it, 84 times inside the 60 second observation window, three
`<Error>` lines each. All 252 lines reach `upgrade_error_messages.txt` and fail
the job on a by-design test error. This is the `FIXME ClickHouse#39174` class the
surrounding comment block already documents.

The entry names the column and the `MergeTreeSequentialSource` read path rather
than the emitting component, for two reasons. The error leaks in three shapes
(`MutatePlainMergeTreeTask:`, the `executeStep()` line, and the wrapping
`MergeTreeBackgroundExecutor:` line, 84 each), which only the shared message
substring covers in one entry; and both qualifiers carry signal. Dropping the
column name would also mask `Unexpected const virtual column: _sample_factor`,
which from a mutation is ClickHouse#78465, the bug 04510 exists to guard. Dropping the
read-path phrase would mask a regression on the query read path, which fills
`_table` today. `_database` is left unmasked deliberately: no test mutates on
it, so a first occurrence should be reviewed rather than pre-suppressed.

Validated by replaying the failing run's 140435-line pre-filter log through the
scan pipeline. The unmodified filter reproduces the job's own
`upgrade_error_messages.txt` byte for byte (252 lines); with the entry no line
survives and the job reports `No Error messages after server upgrade`. Exactly
those 252 lines are removed. Twelve control lines, built from the real ones by
substituting a single field, all still surface: `_sample_factor`, `_database`, a
`LOGICAL_ERROR` from the same task, and the query-path variant.
@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 Aug 31, 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; 1 finding), plus my own cold review
of the diff beforehand. Neither raised a blocker or a major.

# Sev Finding Verdict Evidence / action
1 💡 The body does not use the template's relationship-link format; replace the shorthand #39174, #109813 and #113983 with Related: https://... lines DISAGREE That instruction governs the lines inside the template's own leading HTML comment block, and this body's block carries Related: https://github.com/ClickHouse/ClickHouse/issues/39174 verbatim, so the format is met. The other two references are prose in ### Description, which the template does not constrain. Applying the remedy would move the issue link out of the rendered body into an HTML comment, contradicting the standing request to keep it visible where it renders. Nothing validates these links either: pr_labels_and_category.py errors only on a missing or duplicated changelog category.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal
per finding.

My cold review re-derived the filter's pattern text from source rather than from the quoted log row
(MergeTreeVirtualColumns.cpp:89, Poco extendedMessage, ExecutionThreadContext.cpp:82,
Exception.cpp:685), and confirmed the comment's claim that only a mutation naming _table can reach
the throw at ReadFromMergeTree.cpp:4862, MergeTreeSequentialSource.cpp:346-350 and
MutationsInterpreter.cpp:1968-1978.

Session id: cron:clickhouse-review-slot-11:20260831-003600

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 31, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, and offline. Replaying the failing run's real 140435-line clickhouse-server.upgrade.log through the scan pipeline extracted from upgrade_runner.sh yields 252 surviving <Error> lines every time. No server, no randomness, no timing.
b Root cause explained? Yes. 04510 asserts DELETE WHERE _table != '' fails; the mutate read path (createMergeTreeSequentialSource) never fills virtual_fields["_table"], so IMergeTreeReader.cpp:157 reaches getFieldForConstVirtualColumn and throws NO_SUCH_COLUMN_IN_TABLE (MergeTreeVirtualColumns.cpp:89). It is a background task, so the client sees only the asserted UNFINISHED while Code: 16 is logged at <Error>. --upgrade-check implies --fake-drop, so the table and its failed mutation outlive the test and the new server retries it 84 times in the 60s window, 3 lines each = 252.
c Fix matches root cause? Yes. The defect is CI signal, not product behavior, so the layer is the allowlist that the enclosing FIXME #39174 block exists for ("stress tests may leave behind intentionally-broken mutations that retry after upgrade"). No bound widened, no test weakened, no data reduced.
d Test intent preserved / new tests added? Preserved. 04510 is untouched and still asserts its UNFINISHED. The check keeps its ability to catch every other <Error>: 12 negative controls survive and the whole-pipeline A/B removes only the 252 target lines. No source code changed, so no regression test applies; for a filter change the controls are the equivalent assertion.
e Both directions demonstrated? Yes. Pristine filter: 252 survivors, job reds, and the output is identical to CI's own upgrade_error_messages.txt from that run (so the harness is the real filter). With the entry: 0 survivors, job reports No Error messages after server upgrade. Diff between arms: 252 removed, 0 added, 0 removed lines lacking the signature.
f Fix is general across code paths? Yes. The error leaks in three line shapes (MutatePlainMergeTreeTask:, ...::executeStep():, MergeTreeBackgroundExecutor:, 84 each); the one shared substring covers 252/252. The replicated sibling MutateFromLogEntryTask is already masked. The other two getFieldForConstVirtualColumn callers cannot throw: one always passes BlockNumberColumn::name, the other iterates virtuals_useful_for_filter, all six of which are in the switch.
g Fix generalizes across inputs (params/datatypes/wrappers)? Deliberately scoped, and the scope is measured. Other column names and other read paths stay visible on purpose. Mutating the entry to drop the column name masks 9 of 12 controls (including _sample_factor, which from a mutation is #78465, the bug 04510 guards); dropping the read-path phrase masks 3 of 12. Both components earn their place. Type wrappers do not apply to a log-line filter.
h Backward compatible? (maintainer-approved exception only) N/A. No setting, no serialization, no product code, so no SettingsChangesHistory.cpp entry. upgrade_runner.sh ships from the PR's own tree, so master alone fixes master CI and no release-branch action is needed.
i Invariants and contracts preserved? The invariant: a <Error> line is suppressed only if it is the by-design _table mutation failure; every other occurrence still reds the job. It holds on all paths, because the change is one fixed string added to an existing rg -Fav list: it cannot alter the pipeline's structure, ordering or exit status, the 23 downstream stages are unchanged in both arms, and it cannot match a line lacking the literal (0 of the 217 non-signature <Error> lines in the real log).

Session id: cron:clickhouse-impl-slot-5:20260831-002000

@clickhouse-gh

clickhouse-gh Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [16058d9]

Summary: ✅


AI Review

Summary

This PR adds one allowlist entry to tests/docker_scripts/upgrade_runner.sh so the upgrade check stops failing on the intentional _table mutation error from 04510_mutation_query_plan_only_virtual_columns after restart. I checked the current diff against the surrounding log-scrub pipeline, the 04510 test, and the MergeTree virtual-column code paths; the new matcher stays scoped to the known background-mutation replay and I did not find a correctness, coverage, or metadata issue in the change.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 31, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @fm4v, could you review this? It adds one fixed string to the upgrade check server-log allowlist for the mutation error that 04510_mutation_query_plan_only_virtual_columns asserts on purpose, scoped to both the column name and the MergeTreeSequentialSource read path so a _sample_factor regression and the query-path variant still red the job.

alexey-milovidov added a commit that referenced this pull request Sep 10, 2026
`04510_mutation_query_plan_only_virtual_columns` asserted that
`ALTER TABLE ... DELETE WHERE _table != ''` fails with `UNFINISHED`, because the
per-part read path could not materialize `_table`. This change makes that
mutation succeed, so the test now asserts the fixed behavior: the row is
deleted and one row remains.

For the same reason the `Unexpected const virtual column: _table: While
executing MergeTreeSequentialSource.` entry in the upgrade check error
allowlist (added in #117218 as a workaround for exactly this bug) is removed:
the pending mutation replayed after the upgrade now succeeds, so the message is
no longer produced, and keeping the entry would mask a regression of this fix.

The new test is renumbered to `05175_mutation_table_database_virtual_columns`,
the next free number after the merge with `master`.

Co-Authored-By: Claude Opus 5 (1M context) <[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 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.

4 participants