Repository navigation
Speed up 04143_low_cardinality_single_dict_read_amplification in the flaky check - #125795
Conversation
…flaky check `OPTIMIZE TABLE lc_single_dict_repro FINAL` rewrote the single part the INSERT had already written: part_log of the failing amd_debug flaky check of ClickHouse#115050 shows all_1_1_0 -> all_1_1_1 with the same 131072 rows and the same 8025952 bytes. Under the flaky check's ThreadFuzzer it took 140-157 s of each 165-181 s run on amd_debug (83-87%), 84-86% on amd_binary and 65% on amd_asan_ubsan, so the test crossed the 180 s cap. The queries now read the INSERT's part directly. Its layout is the same (same rows and compressed bytes), the existing has_one_dict check still asserts the single-dictionary precondition, and the reference is unchanged. With the single-dictionary detection disabled in SerializationLowCardinality the read-amplification line still turns 0 (ReadCompressedBytes / data_compressed_bytes 104.5 vs 0.935 with it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (1 nit, PR description only).
Severity: ❌ blocker / |
|
Workflow [PR], commit [2f88bb4] Summary: ❌
AI ReviewSummaryThe PR removes a redundant Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; normal CI completion remains pending. |
|
cc @Avogar, could you review this and add the |
| arrayMap(i -> repeat('8 bytes|', 16) || toString(number % 8000), range(20)), | ||
| if(intDiv(number, 32) % 2 = 0, 1, 0) | ||
| FROM numbers(128 * 1024); | ||
|
|
There was a problem hiding this comment.
Don't we need to ensure somehow (settings, or checking + optimizing) that the table has, in fact, one part? I don't see what in the INSERT guarantees this, specially with randomized settings (maybe we don't randomize those that might affect)?
There was a problem hiding this comment.
Nothing in the test asserted it, so I added a check in 2f88bb4: the test now prints the active part count right after the INSERT, and the reference expects parts 1.
Why it is one part today: the INSERT converts to the table types before squashing, so the squashed block is already LowCardinality. Its 131072 rows are below min_insert_block_size_rows (1048449) and its bytes are far below min_insert_block_size_bytes (256 MiB), so squashing emits a single block. Neither setting is randomized. The insert-related settings that are randomized or set by a CI job (max_insert_threads = 16, max_block_size = 8000, optimize_trivial_insert_select = 1, async_insert = 1) all still give one part. With min_insert_block_size_rows = 100000 the INSERT writes two parts, and the test now fails on the new line.
The removed `OPTIMIZE ... FINAL` used to merge the table into one part. The INSERT already writes one part: its 131072 rows are below `min_insert_block_size_rows` and the squashed `LowCardinality` block is far below `min_insert_block_size_bytes`, so squashing emits a single block. Neither setting is randomized. The randomized settings that touch this INSERT (`max_insert_threads`, `max_block_size`, `optimize_trivial_insert_select`) and `async_insert` still give one part. Assert the part count instead of relying on it, as ClickHouse#125263 does for 04073. With `min_insert_block_size_rows = 100000` the INSERT writes two parts and the test now fails on this line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 2f88bb4Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261014-203009 |
|
Fixing PR for 03323_union_all_constants_bug (Stateless tests (amd_debug, parallel)) created: #125872 |
2d7962a
`03173_row_binary_and_native_with_binary_encoded_types`, `04073_parallel_replicas_in_order_splits`, `00223_shard_distributed_aggregation_memory_efficient` and `04143_low_cardinality_single_dict_read_amplification` now average well below 60 s under MSan after fixture speedups on `master` (#125263, #125795). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #115050
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required (CI fix).
Description
The flaky check of #115050 fails
04143_low_cardinality_single_dict_read_amplificationwithTest runs too long (> 180s)at 182.5 s and 181.3 s (amd_debug report). Any PR that touches the file gets this red.OPTIMIZE TABLE lc_single_dict_repro FINALonly rewrote the single part the INSERT had already written (the job'spart_logshows the same 131072 rows and 8025952 bytes before and after). Under the flaky check's ThreadFuzzer it took 83-87% of eachamd_debugrun (140-157 s), 84-86% onamd_binaryand 65% onamd_asan_ubsan. It is removed, so the queries read the inserted part (the same cause as04073in #125263). A newpartsline asserts that the INSERT wrote the single part the queries rely on. TheTagsline is unchanged, so this merges cleanly with #115050.Validation: the read-amplification check still fails with the single-dictionary detection in
SerializationLowCardinalitydisabled, and 50 runs pass on debug and ASan. Under the ThreadFuzzer with 8 concurrent copies on one machine, a run takes 49-62 s, where every run of the old file exceeded 760 s.Workflow [PR]
Sync PR [sync-upstream/pr/125795]
Version info
26.10.1.2459-master(included in26.10and later)