Repository navigation
Upgrade check: do not report a failed system.mutations query as an unfinished mutation - #121315
Conversation
…finished mutation The mutation-across-upgrade probe asks system.mutations whether the mutation submitted to the old server was finished by the new one. That query cannot be narrowed to the table it is about: StorageSystemMutations::fillData resolves every table it enumerates (StorageSystemMutations.cpp:91) before the *MergeTree narrowing at :95 and the predicate at :128, and getTablesIterator waits on each table's startup job and rethrows its exception (DatabaseOrdinary.cpp:722-741). One unrelated table that cannot load therefore makes the probe throw whatever the WHERE says. `var=$(clickhouse-client ...) ||:` then erased the throw: stderr went to the job log, the exit status was discarded, and the variable was left as the empty string. Only `= 1` was tested, so empty fell into the else branch and the job reported that this mutation had not finished. The diagnostic dump reads system.mutations too, so it threw for the same reason and the artifact the message pointed at was 0 bytes. Over 14 days of CIDB this produced 9 such rows on 9 unrelated pull requests against 225 passes, with an empty failure context every time. On ClickHouse#121247 the mutation was applied at 07:59:40.104 while all 60 probe executions ran between 08:00:35 and 08:01:39 and every one of them threw, so the report named the wrong subsystem and carried no evidence for it. The underlying load failure in those runs was the Keeper feature-flag error already fixed by ClickHouse#120932; this change is the attribution half. Give the probe three outcomes instead of two, which is the idiom this file already uses for its two other system.mutations probes at :203 and :220: keep the answer-1 and answer-0 rows exactly as they were, and report a thrown probe as its own row carrying the real error text. That row stays a FAIL, because the check could not be performed and passing silently would lose the same signal in the other direction. The assertion is neither relaxed nor narrowed and a genuinely unfinished mutation still reds byte-identically. The `||` guard is load-bearing rather than decoration: `set -ex` is in effect, and `A || B` with an assignment for B always succeeds. The existing if/then/break/fi is kept for the same reason, since a false `&&` list as the last command of the loop body would exit the job. The probe's stderr is captured so the new row can carry its cause, and removed when empty per the convention already at :239 and :439. The dump gains 2>&1 so it can no longer be the empty artifact a message points at. Requested at ClickHouse#120908 (comment) 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; 0 findings), plus my own cold review
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20260921-100600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260921-092300 |
|
Workflow [PR], commit [ba869a9] Summary: ✅ AI ReviewSummaryThis PR changes Final Verdict
|
| FROM system.mutations WHERE database = 'default' AND table = 'mutation_across_upgrade') | ||
| AND (SELECT sum(v) FROM default.mutation_across_upgrade) = 500500") ||: | ||
| AND (SELECT sum(v) FROM default.mutation_across_upgrade) = 500500" \ | ||
| 2> /test_output/mutation_across_upgrade_error.txt) || mutation_across_upgrade_finished=cannot_check |
There was a problem hiding this comment.
Lots of sloppy comments but the most useful part is just "2>&1"
de6b47a
Related: #120908
Related: #120932
Related: #120978
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Report a failed
system.mutationsprobe in theUpgrade checkas a failed probe, instead of as a mutation that did not finish.Description
Requested in #120908 (comment), accepting the offer in #120908 (comment). The server-side cause of that run's red was #120932, already merged and on this base; this PR is the diagnostics half only, and it does not relax the assertion.
Upgrade checkreportedThe mutation submitted before the upgrade was not finished by the new serverin runs where the mutation demonstrably did finish. 14 days of CIDB: 225 OK, 9 FAIL across 9 unrelated PRs since #120978 added the row, failure context empty in all 9. On #121247 the mutation was applied at 07:59:40.104 while all 60 probe executions ran 08:00:35..08:01:39, every one thrown.system.mutationsresolves every table it enumerates before the*MergeTreenarrowing and the predicate (StorageSystemMutations.cpp:89-128), and rethrows each table's failed startup job, so one unrelated unloadable table makes the probe throw whatever theWHEREsays.var=$(...) ||:then turned the throw into the empty string, which is not1and so was read as "not finished". The dump reads the same table, so the artifact the message named was 0 bytes.The probe now has three outcomes instead of two, using the idiom already at
:203and:220: a thrown probe gets its own row, stillFAIL, carrying the real error text. A genuinely unfinished mutation reds byte-identically to today, measured against a real server withSYSTEM STOP MERGESholding a real mutation, and against one whose async load job genuinely failed.If you would rather one broken table produced one row and not two, making that third outcome non-failing is a one-line change, your call.
Workflow [PR]
Sync PR [sync-upstream/pr/121315]
Version info
26.10.1.501-master(included in26.10and later)