Repository navigation
Backport #90880 to 25.10: Add setting for compatibility serialziation of string - #91322
Conversation
ad65e75 to
3f514ee
Compare
|
Workflow [BackportPR], commit [f545c10] |
e062a0a to
f545c10
Compare
There was a problem hiding this comment.
Pull request overview
This backport adds a new setting serialize_string_in_memory_with_zero_byte to maintain compatibility when querying clusters with mixed ClickHouse versions. The setting controls whether String values are serialized with a trailing zero byte during aggregation operations, allowing older and newer versions to communicate correctly.
Key changes:
- Adds
serialize_string_in_memory_with_zero_bytesetting (default: true) for backward compatibility - Threads serialization settings through aggregation and column serialization paths
- Updates all column serialization/deserialization methods to accept optional settings parameter
- Includes integration tests verifying cross-version compatibility
Reviewed changes
Copilot reviewed 74 out of 75 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Core/Settings.cpp |
Adds the new boolean setting with documentation |
src/Core/SettingsChangesHistory.cpp |
Registers setting in version history for 25.8 and 25.10 |
src/Columns/IColumn.h |
Introduces SerializationSettings struct and updates method signatures |
src/Columns/ColumnString.cpp |
Implements conditional zero-byte serialization based on setting |
src/Columns/ColumnUnique.h |
Handles deserialization adjustment for zero-byte handling |
src/Common/ColumnsHashing.h |
Propagates settings through hash method context |
src/Interpreters/Aggregator.h |
Adds setting to aggregator parameters |
src/Interpreters/AggregationMethod.cpp |
Updates all aggregation method implementations |
tests/integration/test_string_aggregation_compatibility/test.py |
Integration tests for cross-version compatibility |
| Multiple column implementations | Updates serialization signatures across all column types |
| {"distributed_cache_receive_timeout_ms", 3000, 3000, "New setting"}, | ||
| {"distributed_cache_send_timeout_ms", 3000, 3000, "New setting"}, | ||
| {"distributed_cache_tcp_keep_alive_timeout_ms", 2900, 2900, "New setting"}, | ||
| {"serialize_string_in_memory_with_zero_byte", true, true, "New setting"}, |
There was a problem hiding this comment.
Corrected spelling of 'serialziation' to 'serialization' in PR title.
| throw Exception(ErrorCodes::ATTEMPT_TO_READ_AFTER_EOF, "Not enough data to deserialize string value in ColumnUnique."); | ||
|
|
||
| size_t ret = uniqueInsertData(in.position(), string_size); | ||
| size_t ret = uniqueInsertData(in.position(), string_size - serialize_string_with_zero_byte); |
There was a problem hiding this comment.
Subtracting a boolean from string_size to adjust for the zero byte is fragile. If serialize_string_with_zero_byte is true (non-zero), this computes string_size - 1, which is correct. However, explicitly using a ternary operator would make the intent clearer and avoid potential issues if the boolean is somehow not 0 or 1. Consider: string_size - (serialize_string_with_zero_byte ? 1 : 0) or adding a comment explaining the boolean-to-int conversion.
| size_t ret = uniqueInsertData(in.position(), string_size - serialize_string_with_zero_byte); | |
| size_t ret = uniqueInsertData(in.position(), string_size - (serialize_string_with_zero_byte ? 1 : 0)); |
Original pull-request #90880
Cherry-pick pull-request #91302
This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.
The PR source
The PR is created in the CI job