Repository navigation
Pin the part layout of the lazy_final_early_exit_limit performance test - #122660
egor-click merged 1 commit into
Conversation
Each fill INSERT squashes the numbers_mt stream in the order the SELECT threads deliver its 65409-row blocks and cuts a part once min_insert_block_size_rows (1048449) rows have accumulated, i.e. every 17 blocks, so each INSERT writes 8 parts whose key ranges depend on thread timing. perf.py fills both servers at the same time and merges stay stopped, so the two servers of a comparison measure different 16-part tables for the whole test. Queries #0 and ClickHouse#1 stop at their LIMIT and read a layout-dependent number of rows: on ClickHouse#120186 the new server read 31% more rows for both, and the dashboard gate reported +17.9% and +19.3% as confirmed regressions. Both INSERTs now set min_insert_block_size_rows = 10000000 (above the 8000000 rows of an INSERT) and min_insert_block_size_bytes = 0 (an INSERT is ~350 MB, so the 256 MiB default would still cut it in two). Each INSERT becomes one block, sorted by the key when written, so both servers get the same two intersecting parts, the fixture the test was measured with. A throwIf fill query fails the test if the table does not have exactly 2 active parts. max_insert_threads cannot do this: it only fans the squashed blocks out to the insert sinks. 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 (0 findings). Nothing to adjudicate. Session id: cron:clickhouse-review-slot-11:20260928-102100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20260928-093500 |
|
Workflow [PR], commit [7593f8f] Summary: ✅
AI ReviewSummaryThis PR stabilizes the Final Verdict✅ No findings. |
…test The two compared servers each built a different copy of the fixture: - `rand64() % 5000000` makes the number of rows with key 5, which queries ClickHouse#1 and ClickHouse#3 look up, a fresh draw per server (0 to 3 over 10 local fills); - each INSERT is squashed into ~5 parts (cut at min_insert_block_size_rows), which merge until perf.py's --stop-merges freezes them at a per-server point. ClickHouse#1 and ClickHouse#3 read about one granule per part, so each server read its own number of granules: in CI the servers read different parts in 80% of runs, and time follows the rows read (correlation 0.85-0.88). This redded unrelated PRs (e.g. ClickHouse#118662, arm 4/6, ClickHouse#1 +37.5% confirmed_regression) and inflated the learned threshold of ClickHouse#1/ClickHouse#3 to 0.41-0.53 (0.04-0.09 for #0/ClickHouse#2/ClickHouse#4 on the same tables); the dashboard now caps both at likely_regression as "Flaky lately", so a real regression there cannot red. Use deterministic data, cityHash64(number, 7) and cityHash64(number, 11) modulo 5000000 (same key range and duplicate profile; the seeds put key 5 once in each table, the modal case of the random draw, so ClickHouse#1/ClickHouse#3 keep measuring a non-empty point join), and write each table as one part with min_insert_block_size_rows = 10000000, min_insert_block_size_bytes = 0 (5M rows give one squashed block). A throwIf on system.parts fails the fill if the layout ever drifts. Same shape as ClickHouse#122479 and ClickHouse#122660. Validated through perf.py --stop-merges on two servers, 5 fresh fills per arm: new fixture identical on all 10 server fills (one part per table, same data, ClickHouse#1/ClickHouse#3 read 2 granules on both, #0/ClickHouse#2/ClickHouse#4 read 10M rows); old fixture different on all 5 iterations. Without the insert settings the throwIf fails the fill. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #120186 (comment)
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
lazy_final_early_exit_limitperformance test now writes each of its two inserts as exactly one part, so both compared servers read the same table.Description
Performance Comparison (arm_release, master_head, 5/6)failed on #120186 with this test as its only red reason: job,#020.7 -> 24.4 ms and#130.4 -> 36.3 ms, bothconfirmed_regression. That PR removes a Distributed setting these queries do not use; the new server read 31% more rows for both (16 parts on each side). Master shows the same shift between near-identical builds:d122a9ff658f,#1+21.5% rows, +17.2% time.Each insert squashes
numbers_mtblocks in thread-arrival order and cuts a part once 1,048,449 rows have accumulated, so it writes 8 parts with timing-dependent key ranges. Both servers are filled concurrently with merges stopped, so each measures its own layout, and#0/#1, which stop at theirLIMIT, read a layout-dependent number of rows. In 150+ arm runs since 2026-09-27, the two servers read different row counts in 99-100% of runs, and time follows rows (correlation 0.93 / 0.90).Both inserts now set
min_insert_block_size_rows = 10000000, min_insert_block_size_bytes = 0(an insert is ~350 MB, above the 256 MiB default), so each writes exactly one part, and athrowIffails the job unless 2 parts are active. That is the "2 intersecting parts" fixture the test was measured with, and the shape of #122479. Only the fill changes; each query's lazy FINAL decision is unchanged.Validated with the master release build (amd64): two concurrent fills built different layouts in 6 of 6 runs before and the same two parts in 6 of 6 after. Under
perf.py --stop-merges, one server read 5% more rows for#1in 2 of 3 runs before; after, both read identical rows from byte-identical parts in 3 of 3. The per-run early-exit race of#0remains, and the fill takes ~1.5 s longer. Releases 25.3 to 26.9 (six tested) also get 2 parts.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/122660]
Version info
26.10.1.924-master(included in26.10and later)