Repository navigation
Fix part serialization info after column mutation - #102817
Conversation
|
Workflow [PR], commit [6e13d2f] Summary: ✅
AI ReviewSummaryThis PR fixes a Final VerdictStatus: ✅ Approve |
687525f to
6b91330
Compare
6b91330 to
f4ee529
Compare
`MergedColumnOnlyOutputStream` which is used when the mutation should rewrite only specific part columns, creates a writer which uses `data_part` serializations, and later registers new part metadata with mutated columns serialization infos, created in base class and built from storage settings. For the cases when the mutation overwrites columns with the serializations different from the storage-defined ones, this produces a divergence in on-disk files layout and in-memory part metadata. This patch adds synchronization between serializations used by writer and serializations in new part metadata.
f4ee529 to
bd171e0
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a MergeTree mutation edge case where partial column rewrites could leave the newly created part’s in-memory serialization metadata inconsistent with the on-disk column layout when the source part uses non-default (per-part) serialization settings. It synchronizes the serialization settings used to build new_serialization_infos with the serializations actually used by column-only mutation writers, and adds a stateless regression test.
Changes:
- In
getColumnsForNewDataPart(), explicitly distinguish “source part” vs “storage defaults” serialization settings and reuse them consistently depending on whether the mutation affects all columns. - When doing partial mutations and the source-part serialization settings differ from storage defaults, materialize serialization infos for updated columns to prevent unintended inheritance of storage-default serializations.
- Add a regression test that moves a part between tables with different
string_serialization_versionsettings and then runs a column mutation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Storages/MergeTree/MutateTask.cpp |
Ensures new-part serialization metadata matches the serialization actually used during partial (column-only) mutations when source-part settings differ from storage defaults. |
src/DataTypes/Serializations/SerializationInfoSettings.h |
Adds defaulted equality to compare serialization settings (used to detect source-vs-storage divergence). |
tests/queries/0_stateless/04099_alter_string_non_default_serialization.sh |
Regression test reproducing the “move part to table with different string serialization + mutate column” scenario. |
tests/queries/0_stateless/04099_alter_string_non_default_serialization.reference |
Expected output for the new stateless test. |
|
@groeneai, why did Upgrade Check fail here? |
|
Infra flake in job setup, not this PR. The Upgrade check downloads the previous stable release ( The serialization/mutation change here only runs after install+upgrade, which never happened. Same PR, earlier commits, passed Upgrade check fully green (0/12): bd171e0 (2026-05-18), 6b91330 (2026-04-17), and 3 earlier runs. A re-run should clear it. — Groene AI (session cron:clickhouse-worker-slot-1:20260617-041000) |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 33/33 (100.00%) | Lost baseline coverage: none · Uncovered code |
The Upgrade check downloads the previous stable release `.deb` packages during setup. A transient hiccup that exhausted the small retry budget there (5 attempts, ~45s of total backoff) used to abort the whole job in the setup phase before the actual test ran, and was recorded only as a generic `Download script exit code` with an `OK` status - making it hard to attribute as infrastructure noise. Improve `download_build_with_progress`: - accept a configurable `retries` count; - cap the exponential backoff (`DOWNLOAD_RETRY_MAX_BACKOFF`) so raising the retry count extends the total retry window instead of exploding the per-attempt sleep; - fail fast on a genuine `404` (the artifact was never uploaded) instead of burning the whole retry budget; - treat a truncated response (short read vs. `content-length`) as a transient failure rather than producing a corrupt file that only surfaces much later as an opaque `dpkg` error; - log the HTTP status / error and attempt number on each retry. In `download_packages` (`download_release_packages`): - retry the release packages more persistently (`RELEASE_PACKAGE_DOWNLOAD_RETRIES`); - stop silently skipping a missing essential package (the ones `install_packages` installs) - raise a clear, attributable error that distinguishes a genuine `404` from a transient failure, while still tolerating a hiccup on unused extra assets such as `clickhouse-keeper`. Add unit tests for both. ClickHouse#102817 (comment) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix inconsistent part metadata after mutations of columns with non-default serializations
Details
MergedColumnOnlyOutputStreamwhich is used when the mutation should rewrite only specific part columns, creates a writer which usesdata_partserializations, and later registers new part metadata withnew_serialization_infos, created in base class and built from storage settings.For the cases when the mutation overwrites columns with the serializations different from the storage-defined ones, this produces a divergence in on-disk files layout and in-memory part metadata which may lead to LOGICAL_ERROR while reading (e.g. when the reader expects String.size to exist, based on wrong serialization stored in in-memory metadata).
This patch adds synchronization between serializations used by writer and serializations in new part metadata.
Version info
26.6.1.1004