Repository navigation
Propagate data types serialization versions to nested data types - #94859
Conversation
…ate-type-serializations-2
…serialization info only when serialization info version >= with_types
alexbakharew
left a comment
There was a problem hiding this comment.
Hi @Avogar
Just for clarifying: Are you sure that we want to break backward compatibility here? Was it requested by someone or it is just a part of improvements for serialization?
It's not actually backward-incomatible. It's forward-incompatible. Upgrades are safe, old parts will be read with no problems, but downgrades are not safe (unless new setting is disabled before upgrade or
It's continuation of this performance improvement: #82850. That PR was incomplete and didn't propagate the new String serialization to nested data types. |
|
Please merge with master to fix Kafka. |
…:ClickHouse/ClickHouse into propagate-type-serializations-2
…ate-type-serializations-2
…ate-type-serializations-2
…ate-type-serializations-2
…ate-type-serializations-2
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 93.92% (556/592) |
|
@Avogar Can you tell from which versions the downgrade is incompatible? v25.12 could be safe since it introduced the size_stream serialization? |
|
Downgrade to any version that doesn't contain this PR is incompatible (unless this setting was disabled before upgrade, for example using
No, it won't be safe, because in 25.12 we didn't propagate size_stream serialization to all nested String subcolumns, so 25.12 won't be able to read new parts created with enabled new setting. |
… change in 26.3 changelog The entry about `propagate_types_serialization_versions_to_nested_types` (#94859) can cause data loss on downgrade. Moved it to the top of the Backward Incompatible Change section and added bold warnings to make this critical information more visible. See #101429 See #94859 (comment) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Is downgrade the same scenario as rolling upgrade here? By that I mean another node running old version reading parts fetched from a new version. |
|
If during rolling upgrade a new version created a new part with enabled setting, then old version won't be able to read data from this part until it's also upgraded. For safe rolling upgrades, use |
|
Thank you, this wasn't clear to me from the changelog message; now it is! |
…tefunction-version-race `master` has since landed the same fix through ClickHouse#94859 and ClickHouse#112052: `setVersionToAggregateFunctions` now replaces every versioned nested type instead of writing the shared type's `mutable version` field, and it carries custom names (`Nested`, `SimpleAggregateFunction`) over the rebuild. The conflicting parts of this branch are therefore resolved in favour of `master`: its `replaceNestedSimpleTypes` walk supersedes the per-type `doTransformChildren` machinery this branch added, and its handling of `Variant` (descend, keep the discriminator order, fail when two alternatives would collapse) and of `Dynamic` / `JSON` (states keep the version spelled in their own type name) are deliberate decisions taken in review there. What is left of this branch is what `master` does not have yet, and it keeps the branch's intent: the race cannot come back, because the version can no longer be assigned in place at all.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Propagate data types serialization versions to nested data types. For example, String serialization version
with_size_streampreviously was applied only on top-level String columns and Tuple elements. Now it's applied to any String type inside any nested type like Array/Map/Variant/JSON/etc. This behaviour is controlled by MergeTree settingpropagate_types_serialization_versions_to_nested_typesthat is now enabled by default. After this change, newly created data parts cannot be read by older versions, but old parts can be read on new version with no problems. It means that upgrade is safe, but downgrade is not.Documentation entry for user-facing changes
Note
High Risk
Changes MergeTree on-disk serialization behavior (and defaults) so new parts may be unreadable by older ClickHouse versions, with broad impact across many core data types and subcolumn paths (Array/Map/Nullable/JSON/Dynamic/Variant).
Overview
Propagates type-level serialization versions into nested types by default. Adds MergeTree setting
propagate_types_serialization_versions_to_nested_types(enabled by default, tracked inSettingsChangesHistory) and persists/reads it in MergeTreeserialization.json(only written when enabled).Refactors core data type serialization selection. Replaces
doGetDefaultSerialization()withdoGetSerialization(const SerializationInfoSettings &)across manyDataType*implementations, updatesIDataTypeto build/wrap serializations from settings, and adjustsString/Variant/Dynamic/Object(JSON)serializations and subcolumn extraction to reuse the correct nested serializations (including newremoveNamedSerialization()and passing dynamic/typed-path serializations through Object/JSON/shared-data paths).Updates MergeTree writers/merge/mutation paths to pass the new setting into
SerializationInfoSettings, and adjusts/adds tests to reflect new substream layouts and file-open counts (including a new test coveringwith_size_streambehavior inside nested types).Written by Cursor Bugbot for commit 2403b5b. This will update automatically on new commits. Configure here.
Version info
26.3.1.547