Skip to content

Do not run the previous release's 05211 in the upgrade check - #121484

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:ci-skip-previous-release-05211-in-upgrade-check
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:ci-skip-previous-release-05211-in-upgrade-check

Conversation

@groeneai

@groeneai groeneai commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #119728

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 creating, in its previous-release phase, a table whose column type the upgraded server is documented to refuse.

Description

Upgrade check (amd_release) writes two FAIL rows from one cause, e.g. this run:
Error message in clickhouse-server.log and The mutation submitted before the upgrade was not finished by the new server.

The pre-upgrade phase runs the previous release's copy of the suite (upgrade_runner.sh:44 clones the tag, :148 points clickhouse-test at it). At v26.9.1.1629-stable, 05211_backup_log_zero_byte_data_file.sh:18 types five Log family tables AggregateFunction(countResample(10, 5, 1), UInt64, UInt64) and restores a copy of each. #119728 rejects that parameterisation, and shipped as a Backward Incompatible Change saying so: "a table with such a column no longer loads." --upgrade-check implies --fake-drop, so the old server's tables survive the restart and the new binary correctly refuses each one, logging <Error> AsyncLoader::worker: Code: 69.

That failed load is also what breaks the mutation check, which is why the two rows co-occur: StorageSystemMutations::fillData iterates every database at the default skip_not_loaded = false, so DatabaseOrdinary::getTablesIterator waitLoads all startup jobs and waitLoad rethrows. Every SELECT ... FROM system.mutations then throws ASYNC_LOAD_WAIT_FAILED; the runner's probe is a command substitution with ||:, so it yields '', never 1.

So I skip the test in that phase rather than allow-list the log line. Removing the cause clears both rows and keeps the <Error> scan fully sensitive; an allow-list entry could only clear the first, and this file forbids allow-listing the second (:492-495, "a mutation error here is a real finding"). Master's own copy uses empty arrays instead, so the skip is keyed on the cloned test's own text (grep -q countResample) and stops applying by itself when that fixture goes away. #119728 is master-only (26.9/26.8/26.7 all diverged); if it is backported, this needs revisiting.

The mutation row can still fail from other attach failures, which #121315 and #120932 own; this change removes only my cause.

Validation (click to expand)

Reproduced deterministically: v26.9.1.1629 creates t1 (Log) and t6 (TinyLog), a master binary restarts on the same path, and I get one <Error> ... Cannot attach table per table plus a probe result of ''. The same script without those tables gives zero <Error> lines and a probe result of 1.

  • Of all 8 persisted type spellings in the v26.9 suite naming a -Resample combinator or a variance matrix, only 05211's is refused by master, so one skip suffices. No CREATE TABLE ... AS SELECT persists such a state either.
  • Over the suite's 15459 test names, the skip predicate (clickhouse-test:3216, substring) matches exactly 1; the other eight 05211_* tests still run.
  • Across 1280 composed command shapes (8 worker indices x the encrypted-storage coin flip x 40 random get_options draws x real and smoke), clickhouse-test's own parser reads args.skip as exactly ['05211_backup_log_zero_byte_data_file'], and the smoke check's positional test names survive --skip's nargs="+".
  • A real A/B run of clickhouse-test over the cloned suite differs in exactly one line: 05211_backup_log_zero_byte_data_file: [ FAIL ] -> [ SKIPPED ].
  • shellcheck reports the same four pre-existing diagnostics before and after. check_style.py: 15/16 legs pass, the 16th needing CI-side changed_files data.

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

`Upgrade check (amd_release)` writes two FAIL rows from one cause, seen on
2026-09-21 at
https://github.com/ClickHouse/ClickHouse/actions/runs/35645002320/job/106556496138

  Error message in clickhouse-server.log (see upgrade_error_messages.txt)
  The mutation submitted before the upgrade was not finished by the new server

The pre-upgrade phase runs the PREVIOUS RELEASE's copy of the functional suite:
upgrade_runner.sh:44 clones the tag and :148 points clickhouse-test at
previous_release_repository/tests/queries. At v26.9.1.1629-stable,
05211_backup_log_zero_byte_data_file.sh:18 sets

  COLUMN="AggregateFunction(countResample(10, 5, 1), UInt64, UInt64)"

and types five Log family tables with it, then restores a copy of each, so up to
ten persisted tables carry it. A state of that empty `-Resample` range
serializes to zero bytes and cannot be read back, so ClickHouse#119728 rejects the
parameterisation; it merged as a Backward Incompatible Change whose changelog
entry states the consequence outright: "a table with such a column no longer
loads. Before upgrading, drop the column where the engine supports DROP COLUMN,
and the whole table where it does not (Log, TinyLog, StripeLog, Set, Join,
File)." The old server predates the check and accepts the CREATE;
`--upgrade-check` implies `--fake-drop` (clickhouse-test:7854), so the tables
survive the restart and the new binary correctly refuses each one.

That failed load is also what breaks the mutation check, which is why the two
rows always appear together. StorageSystemMutations::fillData iterates every
database (StorageSystemMutations.cpp:81,89) at the default
skip_not_loaded = false, so DatabaseOrdinary::getTablesIterator waitLoads all
startup_table jobs (DatabaseOrdinary.cpp:722-738) and waitLoad rethrows
(AsyncLoader.cpp:476-477). Every `SELECT ... FROM system.mutations` on that
server throws ASYNC_LOAD_WAIT_FAILED; the runner's probe is a command
substitution with `||:` (upgrade_runner.sh:457-461), so the throw yields an
empty string, never equal to 1, and after 60 attempts the second row is written.

Skipping the test in the pre-upgrade phase leaves nothing incompatible behind,
so both rows go away and the `<Error>` scan keeps full sensitivity. An allow-list
entry was the first draft and is the wrong layer: it can only ever clear the
first row, and the second must not be allow-listed, as this file says at
:492-495 ("a mutation error here is a real finding. Do not allow-list a new
one"). It is also the doctrine the mutation-kill comment at :170-190 already
argues for, removing causes rather than growing the list.

The previous release is whatever get_previous_release_tag.py returns at run
time, so a skip on a static test name would outlive its reason. Master's copy of
the same test name already builds that data file out of empty arrays
(faf29df), so an unconditional skip would, at the first release advance
past the aggregate state version, silently stop running a by-then valid test
with nothing reporting that it had expired. The skip is therefore keyed on the
cloned copy's own text and expires by itself. `countResample` is the
discriminator rather than the exact parameterisation, since it covers both empty
spellings the test has used and master's copy contains no `Resample` at all; the
release version is deliberately not the key, because that would hard-code 26.9
and break on a patch release. If the predicate ever stops matching while an
incompatible fixture is still there, the red comes back loudly on the next run,
which is the correct failure direction.

The option has to travel in a bash array. Quoting the value preserves its
embedded space, so the array expands to exactly one argv token when the
predicate matches and to zero when it does not; an unquoted scalar would split
on that space and hand stress.py a stray positional, and a quoted scalar would
pass an empty token in the no-skip branch. Neither the `[ -f ]` guard nor a
non-matching grep trips `set -e` inside an `if` condition, and a release
predating the test is a silent no-skip rather than a `grep: No such file` line
under `set -x`.

Verified: the two-symptom chain reproduces deterministically by letting
v26.9.1.1629 create t1 (Log) and t6 (TinyLog) and restarting a master binary on
the same path, and a run without those tables produces no `<Error>` line and a
probe result of 1. Driving this block with a stress shim that prints its argv,
the v26.9 clone yields exactly one `--skip-func-tests` token while master's own
copy of the test and a missing file each yield zero extra tokens and no empty
one; stress.py's own parser then reads skip_func_tests as the intended value and
as the empty string respectively. Over 1280 composed command shapes per branch
(8 worker indices x the encrypted-storage coin flip x 40 random get_options
draws, real and smoke) clickhouse-test's own parser reads args.skip as exactly
['05211_backup_log_zero_byte_data_file'] and as None, with the smoke check's
positional test names intact throughout. Of the 15459 test names in the cloned
v26.9 suite the skip predicate (clickhouse-test:3216) matches exactly one, and
all eight other 05211_* tests still run. Of the eight persisted type spellings
in that suite naming a `-Resample` combinator or a variance matrix, only 05211's
is refused by master, so one skip is enough. shellcheck reports the same four
pre-existing diagnostics before and after.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 22, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

Two independent passes per round over this change: my own cold read of the resulting script, then a
second-model gate review on the same tree, then adjudication of every finding from both. Two rounds.

Round 1 (head 1dfb8ead): 1 major accepted and sent back for a fix, 2 nits accepted.
Round 2 (the tree here): 0 blockers, 0 majors, 0 gate findings.

Finding Verdict
❌ The skip was passed unconditionally, but the previous release is resolved at run time and master carries the same test name with a compatible Array(UInt64) fixture, so the first release advance past the aggregate-state version would have silently stopped running a valid test, with nothing reporting the expired skip. Accepted, fixed. The skip is now keyed on the cloned previous-release copy's own text, so it stops applying by itself; both branches measured.
💡 "creates five Log family tables with it" understated the fixture: five CREATE TABLEs carry the type and the test restores a copy of each, so up to ten tables carry it. Accepted, corrected.
💡 A line citation in the commit message pointed a few lines off the mutation probe. Accepted, corrected.
💡 Two commit-message-only nits remain: a line range that ends one line short of the waitLoad it names, and "the option has to travel in a bash array", which is stronger than the facts. The sibling runner stress_runner.sh:338 passes --skip-func-tests "$SKIP_TESTS_OPTION" with a variable that is never assigned, so a quoted scalar would also have worked; the array is a preference, chosen because it reproduces the current command line byte for byte when no skip applies. Noted, not blocking. Say the word if you prefer the sibling's scalar form.

What the passes confirmed rather than flagged. The attribution: the failing DDL is byte-for-byte
v26.9's own 05211 t6, in the stress worker's test_1 database, and #119728 is a merged, approved
Backward Incompatible Change whose changelog entry states this consequence, so no server change is
owed. That one skip is enough: #119728 rejects two parameterisation classes, not one, so both were
enumerated over the cloned v26.9 suite. The empty -Resample ranges in it are exactly three
(countResample(10, 5, 1), sumResample(65535, 20, 1), groupArrayResample(9223372036854775806, 1048575, 65537)) and only the first reaches a persisted column type; the zero-argument
variance-matrix calls are bare SELECTs, and no persisted type in the suite names a matrix at all.
That the predicate matches exactly one of the suite's 15459 test names, that the option reaches
clickhouse-test's own parser as exactly one --skip value across 3840 composed command shapes
while the smoke check's positional test names survive --skip's nargs="+", and that the mutation
row's co-occurrence is mechanical (skip_not_loaded = false -> waitLoad -> rethrow), so removing
the cause clears both rows without adding an allow-list entry. Blast radius is this job alone:
previous_release_repository appears in this file only, and Upgrade check has one parameterisation.

@groeneai groeneai added the groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding label Sep 22, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 22, 2026
@clickhouse-gh clickhouse-gh Bot closed this Sep 22, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 22, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, 100%, not a rate: let v26.9.1.1629 create test_1.t1 (Log) and test_1.t6 (TinyLog) as its own 05211 does, submit the runner's mutation_across_upgrade mutation, then restart a master binary on the same path. Both FAIL rows appear every run: one <Error> AsyncLoader::worker: Code: 69 ... Cannot attach table per leftover table, and the runner's probe (upgrade_runner.sh:457-461) returning ''.
b Root cause explained? The pre-upgrade phase runs the previous release's suite (:44 clones the tag, :148 points clickhouse-test at it). At v26.9, 05211_backup_log_zero_byte_data_file.sh:18 types five Log family tables AggregateFunction(countResample(10, 5, 1), UInt64, UInt64) and restores a copy of each; #119728 refuses that parameterisation as an approved Backward Incompatible Change, and --upgrade-check implies --fake-drop, so the tables survive the restart. The same failed load breaks the mutation check: StorageSystemMutations::fillData iterates every database at skip_not_loaded = false, DatabaseOrdinary::getTablesIterator waitLoads all startup jobs, and waitLoad rethrows, so every system.mutations query throws ASYNC_LOAD_WAIT_FAILED and the probe's `
c Fix matches root cause? Yes: it removes the cause, so the metadata is never written and both rows go away. Allow-listing the log line was the first draft and is the wrong layer: it clears one of two rows, and this file forbids allow-listing the other (:492-495, "a mutation error here is a real finding"). No src/ change, because the server behaviour is intended and approved.
d Test intent preserved / new tests added? Yes. No test content changes anywhere. v26.9's 05211 stops running in the pre-upgrade phase only; master's 05211 still runs in Stateless and Stress and covers the same defect through Array(UInt64). The <Error> scan keeps full sensitivity because no allow-list entry is added, so nothing new is filtered out of it.
e Both directions demonstrated? Yes, twice. On the cause: with the two tables, 2 <Error> lines and probe ''; the same script without them, 0 <Error> lines and probe 1. On the mechanism: a real A/B run of clickhouse-test over the cloned v26.9 suite differs in exactly one line, 05211_backup_log_zero_byte_data_file: [ FAIL ] becoming [ SKIPPED ].
f Fix is general across code paths? Yes. The change is in the single shared runner; Upgrade check has one parameterisation (ci/defs/job_configs.py:1311-1336) and routes upgrade_job.py to stress_job.py:176-177 to this script, so every flavour is covered by construction. grep -rn previous_release_repository matches only this file, so no other job runs a previous release's suite.
g Fix generalizes across inputs (params/datatypes/wrappers)? Measured, not argued. All 8 persisted type spellings in the v26.9 suite naming a -Resample combinator or a variance matrix were fed to a master binary: only 05211's is refused, and no CREATE TABLE ... AS SELECT persists such a state. Over the suite's 15459 test names the skip predicate (clickhouse-test:3216) matches exactly 1, and the other eight 05211_* tests still run. Across 1280 composed command shapes (8 worker indices x the encrypted-storage coin flip x 40 random get_options draws x real and smoke runs) clickhouse-test's own parser reads args.skip identically and the smoke check's positional test names survive --skip's nargs="+".
h Backward compatible? (maintainer-approved exception only) N/A and trivially yes: no src/, no setting, no SettingsChangesHistory.cpp, no serialized format, no test content. The skip is self-limiting by construction rather than by convention: it is passed only while the cloned previous-release copy of the test still contains countResample, so the first release that ships the Array(UInt64) fixture drops it automatically and the test resumes running. Measured on both branches: the v26.9 clone matches and the option is passed as exactly one argv token; master's own copy of the same test name does not match, and neither does a missing file, and in both of those the option is absent entirely rather than passed empty.
i Invariants and contracts preserved? Yes. The invariant established is that the pre-upgrade phase leaves behind no table whose column type the new server is documented to refuse, and that the skip is no broader than that; both halves are measured above. The scan's own contract is strengthened rather than weakened, since the mutation row stays un-allow-listed and a mutation error after the upgrade remains a real finding. Nothing before or after the edited invocation changes.

Session id: cron:clickhouse-impl-slot-5:20260922-013100, cron:clickhouse-impl-slot-6:20260922-022900

@clickhouse-gh

clickhouse-gh Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3c02bda]

Summary: ✅


AI Review

Summary

This PR makes upgrade_runner.sh skip the previous-release copy of 05211_backup_log_zero_byte_data_file only while the cloned release still contains the incompatible countResample aggregate-state fixture that newer servers are expected to reject after #119728. I traced the new shell branch through stress.py and clickhouse-test's --skip handling and did not find a correctness, safety, or unintended coverage regression in the current implementation.

Final Verdict

Status: ✅ Approve

@azat azat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very ugly solution, before we had no-stress tag but it was removed, I will do a different thing

@groeneai

Copy link
Copy Markdown
Collaborator Author

Understood, I will not push a rewrite here.

The one thing I would rather not decide myself: should this stay open as a stopgap until your replacement lands, or do you want it closed now?

Asking because the failure is still spreading: the signature has hit 11 distinct PRs in the last 15 hours, 5 of them other authors', the most recent at 14:18 UTC today. #121506 adds the same kind of skip for 05079 on the same hunk, so a general replacement covers both.

@azat

azat commented Sep 22, 2026

Copy link
Copy Markdown
Member

This is the correct fix - #121590

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-master PR origin: master/nightly CI monitoring finding 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