Skip to content

Upgrade check: ignore the expected checksum mismatch of uncompressed part files after the upgrade - #130760

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:upgrade-check-ignore-cross-version-metadata-mismatch
Nov 12, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:upgrade-check-ignore-cross-version-metadata-mismatch

Conversation

@groeneai

@groeneai groeneai commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #103395 (comment)
Related: #130674

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

Upgrade check (amd_release) fails Error message in clickhouse-server.log on unrelated PRs with one line, e.g. on #130547 (report):

(MutateFromLogEntryTask): Code: 40. DB::Exception: Checksums of parts don't match: hash of uncompressed files doesn't match (927af98348d6a7f961d6dee2935718cf vs d2f18c547870798ef59b0fa38afadff7). (CHECKSUM_DOESNT_MATCH) (version 26.11.1.1). Data after mutation is not byte-identical to data on another replicas.

After the restart, the upgraded server redoes a merge or mutation that the other replica committed under the previous release and compares the result with the part header in ZooKeeper. Uncompressed part files change format between releases (statistics.packed changed in 26.7 with the auto_statistics_types default and in 26.11 with #123950), so the hash of uncompressed files differs and the replica fetches the part. The upgrade guide (docs/guides/oss/update.mdx) documents this message as expected while replica versions differ, and the statistics author confirmed it in #130674.

The log scan now ignores the line only when the hash of uncompressed files is the sole mismatch. Divergent data of the part's own columns (uncompressed hash of compressed files), a different number of files and the KILL MUTATION different columns hash case still fail the job, since it is the only CI check that reports them. Hidden too, and self-healed by the same fetch: the same line from a same-version merge, and divergent projection data, because each projection is one uncompressed <name>.proj entry of the parent part's checksums.

Validated by running the extracted scan on the #130547 log (1 line -> 0) and on 7 control lines (7 -> 5, every other shape kept), locally and inside clickhouse/stress-test; breaking the new pattern restores both results. No test is committed, because this is test infrastructure.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.2031-master (included in 26.11 and later)

…part files after the upgrade

After the restart, the upgraded server executes a MERGE_PARTS or MUTATE_PART
entry whose result the other replica already committed under the previous
release. checkPartChecksumsAndCommit compares the new part with the ZooKeeper
part header written by the old release. Releases change the byte format of
uncompressed part files: statistics.packed is registered with file_hash only,
so it lands in the "hash of uncompressed files" bucket, and its content changed
in 26.7 (auto_statistics_types default) and in 26.11 (ClickHouse#123950 adds the sum to
basic statistics). The task then logs CHECKSUM_DOESNT_MATCH at error level,
removes the local part and fetches the replica's part. The upgrade guide
(docs/guides/oss/update.mdx) documents this message as expected while replica
versions differ, and the statistics author confirmed it on ClickHouse#130674, but the
post-upgrade log scan treated it as a failure.

Filter the line only when "hash of uncompressed files doesn't match" is the
sole clause. Divergent column data ("uncompressed hash of compressed files"),
both clauses together, a different number of files and the KILL MUTATION
"different columns hash" case still fail the job. The Upgrade check is the only
CI job that reports these lines (the stress tests scan only
"<Error>.*Application"), so a broader filter on "is not byte-identical to data
on another replicas" would remove the only CI detector of divergent column data
after replicated merges and mutations.

Validated by running the extracted scan on the Upgrade check log of ClickHouse#130547
(1 line -> 0) and on 7 control lines (7 -> 5, every other shape kept), with
GNU grep 3.11 locally and inside clickhouse/stress-test. Changing "Code: 40" to
"Code: 41" in the new pattern restores both results.

Related: ClickHouse#103395
Related: ClickHouse#130674

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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; 0 findings) plus my own review (1 finding).

# Sev Finding Verdict Evidence / action
1 💡 The filter also hides a same-version merge or mutation after the restart whose divergence is confined to uncompressed files (checkEqualImpl yields the same sole-clause message) AGREE Accepted trade-off: telling the two apart needs correlating the other replica's commit in the log. Stated in the PR description; the part self-heals by the same fetch.

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-11:20261111-110300

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The scan extracted from master's upgrade_runner.sh, run on the #130547 job's own clickhouse-server.upgrade.log, reports the MutateFromLogEntryTask CHECKSUM_DOESNT_MATCH line every time.
b Root cause explained? The upgraded server redoes a merge or mutation the other replica committed under the previous release; statistics.packed (hashed as an uncompressed file) changed format in 26.7 and 26.11, so the hash of uncompressed files differs from the old release's ZooKeeper header and the replica fetches the part. The upgrade guide documents this as expected; the scan reported it as a failure.
c Fix matches root cause? Yes. The server behaves as documented and as the statistics author ruled in #130674, so the change is in the check, and only for the documented shape (sole clause hash of uncompressed files doesn't match).
d Test intent preserved / new tests added? No test committed: this is test infrastructure. Every other <Error> line is still reported (see e).
e Both directions demonstrated? Yes. #130547 log: master 1 line, this PR 0. Seven control lines: master 7, this PR 5. Changing Code: 40 to Code: 41 in the new pattern restores 1 and 7. Same results with GNU grep 3.11 locally and inside clickhouse/stress-test.
f Fix is general across code paths? One pattern covers both logging sites (MergeFromLogEntryTask, MutateFromLogEntryTask); there is no third one. The stress tests scan only <Error>.*Application, so no other job reports these lines.
g Fix generalizes across inputs (params/datatypes/wrappers)? Version suffix with and without (official build), merge and mutation. Kept: compressed-only mismatch, both clauses, different number of files, different columns hash, unrelated errors.
h Backward compatible? (maintainer-approved exception only) N/A: CI script only, no setting or format change.
i Invariants and contracts preserved? The new filter is one more grep -av stage in the existing chain; bash -n passes and shellcheck reports no new warnings.

Session id: cron:clickhouse-impl-slot-5:20261111-105400

@clickhouse-gh

clickhouse-gh Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d6ed09b]

Summary: ✅


AI Review

Summary

PR #130760 suppresses a specific replicated merge/mutation checksum error in the upgrade log scan to tolerate cross-version changes to statistics.packed. Reviewed head d6ed09b7831edb5f72ded7891c528d3324bf2138. One previously reported Major remains: the same filter suppresses projection row-data divergence. The author explicitly accepts this tradeoff; no new inline findings or thread replies were posted.

Findings

⚠️ Majors

  • Projection row-data divergence can pass the upgrade check — tests/docker_scripts/upgrade_runner.sh:1115. [dismissed by author -- https://github.com/Upgrade check: ignore the expected checksum mismatch of uncompressed part files after the upgrade #130760#discussion_r4537805329]

    MergedBlockOutputStream::finalizePartAsync (src/Storages/MergeTree/MergedBlockOutputStream.cpp:236) and the mutation finalizer (src/Storages/MergeTree/MutateTask.cpp:4403) register each projection's entire checksum as an uncompressed <name>.proj entry. With identical main-table data and file counts but different projected values, only the parent's hash_of_uncompressed_files differs. MinimalisticDataPartChecksums::checkEqualImpl therefore produces exactly the sole-clause error removed here, allowing a projection-results regression to escape this check.

    The author's reply and latest comment acknowledge the blind spot without changing detection. It remains material because refetching repairs the individual replica but hides a projection computation defect that can affect results after all replicas upgrade. Suppress only verified metadata differences, or retain an independent projection-data comparison.

Tests
  • ⚠️ Demonstrate that equal main-table data with differing projection data still fails upgrade validation. Local replay of the original CI artifact changes one reported error to zero; all 12 filter controls and the negative control pass, but they also confirm suppression of the projection-equivalent message. These checks do not establish that suppressing projection divergence is safe.
Final Verdict

⚠️ Request changes. Preserve detection of projection row-data divergence and validate it with a focused case. The existing thread remains unchanged because the author deliberately accepted the limitation.

| grep -av -e "SystemLogQueue.*Queue had been full" \
| grep -av -e "TraceCollector.*CANNOT_READ_FROM_FILE_DESCRIPTOR" \
| grep -av -e "while loading statistics.*ILLEGAL_STATISTICS" \
| grep -av -e "(\(Merge\|Mutate\)FromLogEntryTask): Code: 40\. DB::Exception: Checksums of parts don't match: hash of uncompressed files doesn't match ([0-9a-f]* vs [0-9a-f]*)\. (CHECKSUM_DOESNT_MATCH) (version .*)\. Data after \(merge\|mutation\) is not byte-identical to data on another replicas\." \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Major: Preserve detection of projection row-data mismatches

The parent part's hash of uncompressed files also covers projection data, so this clause does not establish that only metadata differs. MergedBlockOutputStream::finalizePartAsync adds each <projection>.proj using the three-argument addFile, with the projection's entire getTotalChecksumUInt128 as its hash (source). That entry has is_compressed = false; rebuilt projections in MutateTask use the same representation.

For two parts with identical main-table data and file counts but different projected column values, only the parent's hash_of_uncompressed_files differs; its uncompressed_hash_of_compressed_files remains equal. MinimalisticDataPartChecksums::checkEqualImpl therefore emits exactly the sole-clause message removed here. The upgrade check would silently accept a projection-data regression, despite the stated requirement to keep detecting divergent column data. This also applies across versions, independently of the acknowledged same-version metadata tradeoff.

Please verify that differences are confined to approved metadata before suppressing this error, or preserve a separate projection-data comparison. Validate with equal main-table data and differing projection data; string-only controls cannot distinguish this case from the expected statistics mismatch.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed: the line cannot separate projection data from the expected metadata change, so d6ed09b states that divergent projection data is hidden too instead of claiming the job still detects it.

…data

MergedBlockOutputStream::finalizePartAsync and MutateTask register each
projection in the parent part's checksums as `<name>.proj` with the
two-argument addFile, so the entry has is_compressed = false and its hash is
getTotalChecksumUInt128 of the projection part. computeTotalChecksums then puts
it into the parent's "hash of uncompressed files", next to statistics.packed.
A divergence of projection rows therefore produces the same sole-clause
message as the expected statistics format change, and the line alone cannot
tell them apart. The comment claimed that divergent column data still fails
the job; that holds only for the part's own columns. Say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added manual approve Manual approve required to run CI comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). and removed comp-testing Test content only (no production code). labels Nov 11, 2026

@alexey-milovidov alexey-milovidov 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.

Yes, this could be too wide, but I see no other way.

@alexey-milovidov alexey-milovidov self-assigned this Nov 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 12, 2026
Merged via the queue into ClickHouse:master with commit 8b10fe5 Nov 12, 2026
187 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 12, 2026
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 comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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.

3 participants