Repository navigation
Perf CI: stop merges in the main runs and start them before the teardown - #122073
Conversation
The main runs of the performance job go through `CHServer.run_test`, which did not pass `--stop-merges`, so only the `confirm_changes` reruns stopped merges. And a drop query that creates a mutation, such as `ALTER TABLE ... DROP INDEX`, waited for it until `max_execution_time` because `SYSTEM START MERGES` ran only after the drop queries. #121937 (comment) Related: #121937
|
Workflow [PR], commit [b05ff46] Summary: ❌
AI ReviewSummaryThis PR fixes two real gaps in the performance CI runner: the main sampled runs now pass Findings
Final Verdict
|
| # creates a mutation and waits for it, and mutations do not run while merges are stopped. | ||
| if stop_merges: | ||
| for c in all_connections: | ||
| c.execute("SYSTEM START MERGES") |
There was a problem hiding this comment.
This moves SYSTEM START MERGES into a pre-pass over all connections, but the teardown below is deliberately per-connection best-effort (setup_error_on_connection can leave one side half-broken). If START MERGES fails on just one server here, we raise before any drop_query runs on the healthy side, so leftover indexes/columns leak into later tests. Previously the surviving server(s) were still cleaned up before any failure was surfaced. Please restart merges inside each connection's teardown path, or otherwise make sure one bad connection cannot skip cleanup on the others.
Picks up ClickHouse#122073, which passes --stop-merges to the measured performance runs. Before it only the confirm_changes rerun stopped background merges, so the measured samples that feed the dashboard verdict were taken while merges ran. The two dashboard-confirmed regressions on the previous head, optimize_time_filter_with_preimage ClickHouse#6 and index_bulk_filtering ClickHouse#2, are of that noise class: the shard's own report calls the first unstable and the second successful, and neither query can reach this diff, which only parses the vector search arguments of mergeTreeAnalyzeIndexes.
|
@fm4v — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
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]>
|
Update on the earlier review: CI on the proof PR #122329 confirmed the suspected bug via
(Automated follow-up. The proof PR has been closed; please track the bug on the Issue.) |
Two fixes for
--stop-mergesfrom #121937, reported in #121937 (comment):CHServer.run_testinci/jobs/performance_tests.pyand enterscompare.shatstage=get_profiles, afterrun_tests, so only theconfirm_changesrerun passed--stop-merges.run_testnow passes it too.ALTER TABLE ... DROP INDEXintext_index,text_index_lazy_apply,text_index_phrase_blocked,DROP COLUMNintpch-join_algorithm-partial_merge-fixed-str) hung in teardown: withalter_sync > 0theALTERwaits for its mutation, mutations don't run while merges are stopped, andSYSTEM START MERGESran only after the drop queries. TheALTERran intomax_execution_time = 300,perf.pyfailed and left the index on the second server, breaking later tests that add a text index on the same column.perf.pynow starts merges before the drop queries; the measured queries still run with merges stopped.Fix 2 must land with fix 1, otherwise these four tests fail on every run.
Related: #121937
Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/122073]
Version info
26.10.1.652-master(included in26.10and later)