Repository navigation
Fix columns_substreams.txt corruption during column rename in some cases - #102689
Conversation
|
Workflow [PR], commit [9cc071c] Summary: ❌
AI ReviewSummaryThis PR fixes a real Missing context
ClickHouse Rules
Final Verdict
|
yakov-olkhovskiy
left a comment
There was a problem hiding this comment.
fix seems correct, but reference for test is incorrect - seems incorrectly generated by AI?
No, it's because of settings randomization, specifically because of sparse serialization. I will update the test |
…:ClickHouse/ClickHouse into fix-substreams-rename-bug
LLVM Coverage Report
Changed lines: 100.00% (6/6) · Uncovered code |
After PR #103917 silenced the `Tuple element name 'null' is reserved` rejection, the upgrade check now surfaces a different pre-existing issue: parts of `02538_alter_rename_sequence`'s `wrong_metadata_wide` table are detached as broken on the upgraded server with messages like No stream (column1_renamedcolumn1.bin) file checksum for column column1_renamed in part ... This is the bug tracked by issue #102259 (`getFileNameForRenamedColumnStream` uses `substr(0, N)` instead of `substr(N)`, corrupting `columns_substreams.txt` after `RENAME COLUMN`) and the still-open fix in PR #102689. Until those land, allowlist any error referencing the test's `wrong_metadata_wide` table so the upgrade check is not blocked by this unrelated bug. The allowlist substring is the table name, which is unique to `02538_alter_rename_sequence`, so it does not mask other failures. Failing run on this PR: https://s3.amazonaws.com/clickhouse-test-reports/PRs/103917/f62aefdf8983dbeb089bab0a8d8b7f14e71849d8/upgrade_check_amd_release/test_results.tsv Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Cherry pick #102689 to 25.8: Fix columns_substreams.txt corruption during column rename in some cases
…g column rename in some cases
Cherry pick #102689 to 26.2: Fix columns_substreams.txt corruption during column rename in some cases
…g column rename in some cases
Cherry pick #102689 to 26.3: Fix columns_substreams.txt corruption during column rename in some cases
…g column rename in some cases
Cherry pick #102689 to 26.4: Fix columns_substreams.txt corruption during column rename in some cases
…g column rename in some cases
Backport #102689 to 26.4: Fix columns_substreams.txt corruption during column rename in some cases
PR ClickHouse#103917 narrowed the `wrong_metadata_wide` allowlist to the specific corrupted-filename signature emitted by `02538_alter_rename_sequence` after the `getFileNameForRenamedColumnStream` `substr(0, N)` bug (issue ClickHouse#102259, fix in PR ClickHouse#102689). The same bug also surfaces on `02555_davengers_rename_chain`'s `wrong_metadata` table, but with a different column/stream pair, so the narrow regex did not catch it and the upgrade check began failing on unrelated PRs. Add the matching narrow signatures: * `No stream (ba1.bin) file checksum for column b` — the chained rename `a -> a1 -> b` produces `<new=b><old=a1>.bin = ba1.bin` for column `b`. This `<column><stream>` combination is unique to that test and that bug. * Loosen `wrong_metadata_wide` to `wrong_metadata` in the secondary `Detaching broken part` regex so it matches both narrow and wide table variants. The other two substrings (`Detaching broken part` + `backward incompatibility`) keep the allowlist scoped to the same symptom. Verified against the failing log (https://s3.amazonaws.com/clickhouse-test-reports/PRs/103874/49885046aba0893d06655439d554aeac6998469e/upgrade_check_amd_release/upgrade_error_messages.txt): all six lines are filtered, while synthetic unrelated errors (other tables, generic detach notices, log lines that mention the table name in passing) pass through. Source PR with the failing run: ClickHouse#103874
Backport #102689 to 26.3: Fix columns_substreams.txt corruption during column rename in some cases
Backport #102689 to 26.2: Fix columns_substreams.txt corruption during column rename in some cases
Backport of ClickHouse#102689 to 25.8.16: Fix columns_substreams.txt corruption during column rename in some cases
Antalya 25.8, backport of ClickHouse#102689: Fix columns_substreams.txt corruption during column rename in some cases
loadColumnsSubstreams discards a Wide part's columns_substreams.txt when a substream name has a prefix that does not match its column (the rename bug fixed in ClickHouse#102689), returning without installing anything. The empty-columns.txt recovery then reached getFirstFileNameForColumn with no substreams and no serializations, so presence fell through to the default serialization's first stream. A column stored in any other layout has no such stream, so it was judged absent, left out of the rebuilt list, and writeColumns persisted the omission. Measured on a bucketed Map (m.buckets_info, m.0.keys, ... vs the default m.size0, m.keys): sum(length(m)) went 4000 -> 0 with the part still active and columns.txt rewritten without m, i.e. an intact column reading back as defaults. Repairing columns_substreams.txt afterwards did not undo it - the persisted list then disagreed with the file and validateColumns raised a LOGICAL_ERROR on load. Refusing leaves the part detached and hand-recoverable instead. The predicate is exact: MergedBlockOutputStream only writes the file when it is non-empty, so present-but-empty is uniquely the discarded case. A part that never had the file still takes the stream-enumeration fallback, and an intact part with a valid file still recovers, both covered by existing cases in 04545. The new case corrupts whichever substream comes first rather than a fixed name: randomized serialization versions change which streams a column produces, and a name-specific edit silently became a no-op on some runs, making the arm pass without ever corrupting anything.
…tion during column rename in some cases
…2689 Backport ClickHouse#102689 to 26.4: Fix columns_substreams.txt corruption during column rename in some cases
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix columns_substreams.txt corruption during column rename in some cases. Closes #102259
Documentation entry for user-facing changes
Version info
26.4.1.1140,26.3.10.61,26.2.19.13