Repository navigation
Pin the part layout of the read_in_reverse_order_final performance test - #122335
alexey-milovidov merged 1 commit into
Conversation
Since ClickHouse#122073 the measured perf.py runs stop merges on both servers right after the fill. The old fill writes 54 parts in about a second, so each server keeps whatever part set its background merges reached, and the two servers of one run measure different layouts (21 vs 38 parts on ClickHouse#122222, 24 vs 44 on ClickHouse#122154, 22 vs 44 on master 52a67f8). FINAL ... ORDER BY x DESC LIMIT n reads the first reverse ranges of every part (about 23K rows each), so its time grows with the part count, and the dashboard scores the side with more parts as a confirmed regression. The fill now merges the first insert, stops merges on the table and writes the second insert as exactly one part, so both servers read the same two parts whatever the merge timing, like final_read_in_order_limit.xml: - OPTIMIZE ... FINAL waits for the running merges before it selects, so the background merges of the first insert cannot leave it partial, and optimize_throw_if_noop = 1 makes a no-op OPTIMIZE fail with its reason instead of surfacing as a wrong part count. - min_insert_block_size_rows = 16777216 (2^24, above the 10M rows) with min_insert_block_size_bytes = 0: the INSERT squashes on one stream before it fans out to the sinks and never reaches the minimum, so the whole insert is flushed as one part, independent of max_insert_threads, max_block_size and how the numbers_mt threads interleave. - The throwIf over system.parts fails the job unless exactly 2 parts are active, because SYSTEM STOP MERGES on a missing table is a silent no-op. Validated on two servers of one master release build with perf.py --stop-merges, 5 runs per side of the change: before, 14 to 19 parts, different on the two servers in every run, right/left up to 1.18; after, 2 parts and identical SelectedRows on both servers, right/left within 3%. Related: ClickHouse#122073 Related: ClickHouse#121937 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 (2 nits, below).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20260925-202800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20260925-195700 |
|
Workflow [PR], commit [45be1db] Summary: ✅
AI ReviewSummaryThis PR stabilizes Final Verdict
|
Related: #122073
Related: #121937
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
read_in_reverse_order_finalperformance test now fills its table with a fixed layout of two parts and stops merges on it, so both servers measure the same parts.Description
Performance Comparison (arm_release, master_head, 6/6)fails on unrelated PRs with this test as the only named result: #122222 (#00.0060 -> 0.0085 s, +40.6%,confirmed_regression;#1+23.9%) and #122154 (#0+37.5%,#1+25.2%). Master reports itunstabletoo:52a67f8f0e06, 5/6, 5.9 vs 8.9 ms.Since #122073 the measured runs stop merges right after the fill. The fill writes 54 parts in about a second, so each server keeps whatever its merges reached: 21 vs 38 parts on #122222, 24 vs 44 on #122154, 22 vs 44 on that master run.
FINAL ... ORDER BY x DESC LIMIT nreads the first reverse ranges of every part, about 23K rows each, so the side with more parts is slower. @ fm4v named this test in #121937 as one that needs its own fix.The fill now merges the first insert (
OPTIMIZE ... FINAL), stops merges on the table, writes the second insert as one part (min_insert_block_size_rows = 16777216,min_insert_block_size_bytes = 0), and athrowIffails the job unless exactly 2 parts are active. This is the shape offinal_read_in_order_limit.xml. The queries are unchanged.Validated with two servers of one master release build and
perf.py --stop-merges, 5 runs per side of the change: before, the servers read 14 to 19 parts, different in 5 of 5 runs, right/left up to 1.18; after, 2 parts and identicalSelectedRowsin 5 of 5, within 3%. Removing theOPTIMIZEor the insert settings makes thethrowIffire. The series will step down once (#05.7 -> 3.1 ms locally).Workflow [PR]
Sync PR [sync-upstream/pr/122335]
Version info
26.10.1.713-master(included in26.10and later)