Repository navigation
Upgrade check: run the MUTATE_PART entries of the killed mutations before the upgrade - #123376
Conversation
…fore the upgrade The pre-upgrade kill step (ClickHouse#120978) kills every mutation that some replica has not finished. When a test stopped merges or fetches on one replica only (04907_mutation_parts_to_do_deprecated_syntax, 03100_lwu_40_cleanup_race), the other replica has already applied the mutation, and the stopped one still holds MUTATE_PART entries for it. `KILL MUTATION` removes the mutation node but not those entries. After the upgrade the restart lifts the stops, the entry finds no mutation ("There are no mutations for partition ID ..."), clones its source part unchanged, and the commit check against the other replica's mutated part fails with CHECKSUM_DOESNT_MATCH ("Data after mutation is not byte-identical to data on another replicas"), which the `<Error>` scan reports. The engine documents this race in both messages and repairs it by fetching; the scan sees it only because the harness made the upgraded server run the entry. Before the kill, list every replica that shares (zookeeper_name, zookeeper_path) with a table holding an unfinished mutation or a queued MUTATE_PART. After the kill and its count check, `SYSTEM RESTART REPLICA` each of them and check that it came back writable: the restart waits for a running merge selection (so a selection made before the kill has logged or dropped its entry), reloads the mutations from Keeper (where the killed ones are gone), and drops the tests' `SYSTEM STOP`s, i.e. the state the upgrade restart would produce. Then `SYSTEM SYNC REPLICA ... PULL` each, and wait up to 60 s until no replica, read-only ones included, has a MUTATE_PART queued. The old server thus runs the leftovers: an entry nobody applied clones identically, a lagging one mismatches once and fetches the mutated part. Operational failures write a FAIL row with the errors; an entry still queued at the deadline is dumped to undrained_mutation_entries.txt for attribution. The lagging replica's mismatch is now logged by the old server (clickhouse-server.stress.log, not scanned) instead of the upgraded one. Validated on a local rig (26.9.8.3 -> master): the 04907 state reproduces the CI hash pair 351fbe96.. vs b54e201a.. after the upgrade without this change (3/3) and none with it (3/3); the same for the 03100_lwu_40 state ("has different columns hash") and for an entry the lagging replica never pulled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own review (3 nits).
Severity: ❌ blocker / |
|
Workflow [PR], commit [504a6d3] Summary: ✅ AI ReviewSummaryThis PR tightens the upgrade-check cleanup step so killed replicated mutations do not leave stale Final Verdict
|
azat
left a comment
There was a problem hiding this comment.
Let's try, I like this new mutations check overall, but maybe we need to revise it in general.
Related: #120978
Related: #121409
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Upgrade check: run the queued
MUTATE_PARTentries of the mutations killed before the upgrade on the old server, so the upgraded server does not clone a part another replica already mutated.Description
Upgrade check (amd_release)reds unrelated PRs withCHECKSUM_DOESNT_MATCH ... Data after mutation is not byte-identical to data on another replicasontest_1.v0_r2(04907_mutation_parts_to_do_deprecated_syntax, 5 PRs since 2026-09-20) andtest_1.t_lwu_cleanup_1(03100_lwu_40_cleanup_race, 4 PRs), e.g. #122715, #121154. Raised on #119196 (comment).Root cause. Both tests stop merges or fetches on one replica while the other applies a mutation; the stress run interrupts them before the
SYSTEM START. The kill step (#120978) kills the mutation, which is unfinished on the stopped replica, butKILL MUTATIONleaves that replica's queuedMUTATE_PARTentries. After the upgrade the entry findsThere are no mutations for partition ID ..., clones the part unchanged and fails the commit check against the other replica's mutated part.Change, in the kill step: before the kill, list the replicas sharing
(zookeeper_name, zookeeper_path)with a table holding an unfinished mutation or a queuedMUTATE_PART. After it,SYSTEM RESTART REPLICAeach one (it waits for a running merge selection, reloads mutations from Keeper and drops the tests' stops), check it is writable,SYSTEM SYNC REPLICA ... PULL, and wait up to 60 s until noMUTATE_PARTis queued. The old server then repairs the divergence by a fetch, logged in the stress-phase log, which is not scanned. Operational failures write a FAIL row; leftovers go toundrained_mutation_entries.txt.Validation. I rebuilt both states on 26.9.8.3, ran the block, and restarted onto master. Without the change the upgraded server logs the CI hash pair
351fbe96.. vs b54e201a..(3/3) andhas different columns hash; with it, none (3/3). Also checked: a never-pulled entry, a broken mutation, nothing to drain (+0.05 s), a failing restart (FAIL row), and no restart pass (reproduces).Workflow [PR]
Sync PR [sync-upstream/pr/123376]
Version info
26.10.1.1429-master(included in26.10and later)