Fix flaky test 02377_extend_protocol_with_query_parameters#101437
Fix flaky test 02377_extend_protocol_with_query_parameters#101437groeneai wants to merge 1 commit intoClickHouse:masterfrom
Conversation
Pin map_serialization_version and map_serialization_version_for_zero_level_parts to 'basic' in the test's CREATE TABLE SETTINGS. When CI randomizes these to 'with_buckets', Map keys get distributed into hash buckets which changes their iteration order on readback, causing non-deterministic output. This test validates query parameter passing, not Map serialization — key order is irrelevant. 10 failures across 7 PRs in 30 days (amd_tsan, amd_asan_ubsan, amd_msan, amd_debug, arm_binary, amd_llvm_coverage). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pre-PR Validation GateSession: a) Deterministic repro? ✅ clickhouse-client --allow_merge_tree_settings \
--map_serialization_version with_buckets \
--map_serialization_version_for_zero_level_parts with_buckets \
--max_buckets_in_map 4 --map_buckets_strategy constant --map_buckets_min_avg_size 1 \
-q "CREATE TABLE t (id Int64, map_arr Map(UInt8, Array(UInt8))) ENGINE=MergeTree ORDER BY id;
INSERT INTO t VALUES (42, {10:[11,12], 13:[14,15]});
SELECT * FROM t; -- outputs {13:[14,15],10:[11,12]} instead of {10:[11,12],13:[14,15]}
DROP TABLE t;"b) Root cause explained? ✅ c) Fix matches root cause? ✅ d) Test intent preserved? ✅ e) Both directions demonstrated? ✅ |
|
cc @alexey-milovidov — could you review this? Test-only fix pinning map serialization settings to prevent non-deterministic Map key ordering in the query parameters test. |
|
Workflow [PR], commit [551b63d] Summary: ❌
AI ReviewSummaryThis PR fixes flakiness in ClickHouse Rules
Final Verdict
|
When CI randomizes
map_serialization_versionand/ormap_serialization_version_for_zero_level_partstowith_buckets, Map keys get distributed into hash buckets which changes their iteration order on readback. The test inserts data into a MergeTree table with Map columns and expects a specific key order in the output — but bucketed serialization doesn't preserve insertion order.This caused 10 failures across 7 unrelated PRs in the last 30 days (amd_tsan, amd_asan_ubsan, amd_msan, amd_debug, arm_binary, amd_llvm_coverage).
The fix pins
map_serialization_version = 'basic'andmap_serialization_version_for_zero_level_parts = 'basic'in the test's CREATE TABLE SETTINGS. This is a targeted pin — the test validates query parameter passing with complex types, not Map serialization behavior.Verified: 50/50 passes with full randomization.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes