Repository navigation
Perf CI: rebuild the hits datasets with constant granularity, so both servers read the same layout - #122459
Conversation
Since ClickHouse#110009 each perf server rebuilds hits_10m_single, hits_100m_single and datasets.hits_v1 -> test.hits itself: a 16-thread INSERT ... SELECT, then OPTIMIZE FINAL. The INSERT splits the rows into parts nondeterministically, and the vertical merge with variable adaptive granularity (blocks_are_granules_size in MergeTask) makes every merged granule follow the input parts' granules, so the left and right servers get different granule boundaries. order_by_read_in_order ClickHouse#1 reads in reverse order, only the last granule, whose size is the remainder of that layout: 510 vs 6041 rows on PR 117972 arm 2/6 (+18%), 958 vs 7977 on PR 119090 arm 4/6 (+50.9%). The layout lasts for the whole job, so the difference is perfectly separated and reproducible, and it reds shards. With use_const_adaptive_granularity the merged part's rows per granule is one constant computed from its total rows and bytes, capped at index_granularity. hits rows are 553-713 bytes, far below 10 MiB / 8192, so both servers get 8192-row granules. The setting only affects parts written while it is set, so it is reset after OPTIMIZE FINAL: the part keeps its granules, and CREATE TABLE ... AS clones (trivial_insert_select_from_files measures an INSERT into one) keep the default insert path. The double-check-perf-tests mirror of rebuild_table gets the same two statements, so --populate keeps matching CI. Validated on two local servers with the official master build and the CI datasets, driving the harness function itself: before, every rebuild pair differed (hits_100m_single query ClickHouse#1 read 7977 vs 993 rows); after, all pairs are identical (256 rows). Co-Authored-By: Claude Opus 5.5 <[email protected]>
OPTIMIZE FINAL waits for in-flight merges only for the table's lock_acquire_timeout_for_background_operations (120 s by default), and without optimize_throw_if_noop a timed-out wait is a no-op that still exits 0. The mirror's rebuild_table then reset use_const_adaptive_granularity on a table that still had several parts, so the merges after it wrote variable granules again and the two sides could diverge. The mirror now sends CI's statements: the 600 s merge-lock budget after CREATE, and OPTIMIZE FINAL with optimize_throw_if_noop = 1, optimize_skip_merged_partitions = 1. 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; 1 finding; bounded: 1 full pass + 1 fix round + 1 delta recheck).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20260926-185600 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20260926-165600 |
|
Workflow [PR], commit [b438922] Summary: ✅
AI ReviewSummaryThis PR makes the rebuilt Findings
Tests
Missing context / blind spots
Final Verdict |
| Shell.check(f'{client} --query "ALTER TABLE {target} MODIFY SETTING lock_acquire_timeout_for_background_operations = 600"', strict=True, verbose=True) | ||
| # Variable granularity would make the merged part's granules follow how the parallel INSERT split the | ||
| # rows, which differs between the two servers; a constant one gives both the same layout. | ||
| Shell.check(f'{client} --query "ALTER TABLE {target} MODIFY SETTING use_const_adaptive_granularity = 1"', strict=True, verbose=True) |
There was a problem hiding this comment.
rebuild_table exists so each side rewrites the hits datasets with its own binary and write-time defaults. Forcing use_const_adaptive_granularity = 1 changes that contract: after the OPTIMIZE, the RESET removes the table setting, but the merged part keeps the constant-row granules, so the bulk of the perf suite now runs on a non-default on-disk layout.
That means regressions in the normal use_const_adaptive_granularity = 0 write path stop being visible on the workload that backs most of these comparisons. The PR description validates order_by_read_in_order #1, but it does not show that reshaping all rebuilt hits tables is acceptable for the rest of the suite. This needs either a deterministic rebuild that preserves the default granularity mode, or evidence from a representative before/after perf report that changing the physical layout of these datasets does not mask unrelated regressions.
CI finish ledger - 2c7ef6cEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260926-223058 |
|
@groeneai the rerun didnt work, because there is no binary now, i think it is better to refresh and rerun ci |
…ld-const-granularity
|
I merged current master into the branch (b438922, no conflicts, the PR diff is unchanged), and a fresh CI run has started: https://github.com/ClickHouse/ClickHouse/actions/runs/38741247265. Auto-merge is still enabled. |
Related: #117972
Related: #121456
Related: #110009
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required: CI-only change.
Description
Performance Comparisongoes red onorder_by_read_in_order #1with no regression: PR 117972, arm 2/6 (+18%), PR 119090, arm 4/6 (+50.9%, after #121847), and it is flaggedsloweron master too (amd 4/6 @d43d6067).Since #110009 each server rebuilds the hits datasets itself: a 16-thread
INSERT ... SELECT, thenOPTIMIZE FINAL. The INSERT splits the rows into parts nondeterministically, and the vertical merge with variable adaptive granularity makes each merged granule follow the input parts, so the two servers end up with different granule boundaries. Query #1 reads in reverse order, i.e. only the last granule, whose size differs between the servers: 510 vs 6041 rows read in the first job, 958 vs 7977 in the second. The layout lasts for the whole job, so every run and the confirmation rerun see the same difference. Over 30 days, 3487 of the 3491 arm runs with a difference above 15% read different rows on the two sides.rebuild_tablenow setsuse_const_adaptive_granularity = 1before the INSERT, so both servers write 8192-row granules (the table'sindex_granularity), and resets it afterOPTIMIZE FINAL, soCREATE TABLE ... ASclones (the insert benchmark intrivial_insert_select_from_files) keep the default. The parts are still written by each server's own binary; only the number of rows per granule is pinned. Thedouble-check-perf-testsmirror gets the same two statements and CI's fail-closedOPTIMIZE FINAL, which it was missing, so--populaterebuilds exactly like CI.Validated with the harness function itself on two local servers (official master build, the CI datasets): before the change every rebuild pair differed, after it every pair is identical.
Local validation
hits_10m_single, last granule, 3 pairshits_100m_single, query #1 rows read, 2 pairsAfter the rebuild, neither the table nor a
CREATE TABLE ... ASclone carries the setting (a clone taken before the reset does), and the reset does not rewrite the part. Thetext_index.xmlfill queries still work on the rebuilt table.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/122459]
Version info
26.10.1.2496-master(included in26.10and later)