Repository navigation
[CI Proof] read_in_reverse_order_final flaky: --stop-merges freezes mid-merge layouts - #122329
clickgapai wants to merge 1 commit into
Conversation
`perf.py --stop-merges` stops merges right after the setup, so the merge still running there is cut off and the measured part layout depends on timing (`SelectedParts` 18 vs 34 between the servers in the ARM run of ClickHouse#122073). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pre-PR validation: 4/6 ✅a) Deterministic repro? ❌ b) Root cause explained? ✅ c) Fix matches root cause? ✅
d) Test intent preserved? / New tests added? ❌ e) Both directions demonstrated? ✅ f) Fix is general, not a narrow patch? ✅ |
|
Workflow [PR], commit [5ef0e9b] Summary: ❌
AI ReviewSummaryThis PR adds a stateless proof test that is supposed to show that Findings
Tests
Final Verdict
|
| { | ||
| python3 - "$CURDIR/../../performance/read_in_reverse_order_final.xml" <<'EOF' | ||
| import sys | ||
| import xml.etree.ElementTree as ET | ||
|
|
||
| root = ET.parse(sys.argv[1]).getroot() | ||
| if root.get("keep_merges_running", "0") in ("0", "false", ""): | ||
| for e in root: | ||
| if e.tag in ("create_query", "fill_query"): | ||
| print(e.text.strip().rstrip(";") + ";") | ||
| EOF | ||
| echo "SELECT count() FROM system.merges WHERE database = currentDatabase() AND table = 'read_in_reverse_order_final';" |
There was a problem hiding this comment.
This proof does not exercise the contract described in the PR. perf.py runs SYSTEM JEMALLOC PURGE and then SYSTEM STOP MERGES on both servers, and the reported flake is that those two servers can freeze different part layouts after that stop. Here we only sample system.merges once on a single server before either step, so the test still passes when the merge is queued / not yet visible (or finishes during the extra purge window) even though --stop-merges can still freeze a different layout. Please drive the actual perf.py --stop-merges path and compare a post-stop layout witness on both sides, such as active-part count from system.parts or SelectedParts from the measured query.
There was a problem hiding this comment.
Agreed, and moot now: #122335 pinned this test's part layout on master, so the proof has nothing left to prove.
- One
system.mergessample on one server, taken beforeSYSTEM JEMALLOC PURGE/SYSTEM STOP MERGES, can pass while the two servers still freeze different layouts. - Pin the part layout of the
read_in_reverse_order_finalperformance test #122335 applies the pin this finding suggested:OPTIMIZE ... FINAL, thenSYSTEM STOP MERGES read_in_reverse_order_final, then the second insert as one part, thenthrowIf(count() != 2)over activesystem.parts.perf.pyruns the fill on both servers, and the table's merges stay stopped until the teardown. So that guard checks the layout each side measures. Its two-serverperf.py --stop-mergesruns gave 2 parts and identicalSelectedRowson both sides. - A proof rebuilt around
perf.pywould pass on master. Rebased as it is, this one fails on a stale reference instead: the newthrowIffill query prints an extra row. Replayed against master's XML withclickhouse-local, the guard holds and the output is0,0against a reference of0.
This PR can be closed without merging.
|
✅ |
Suspected bug:
read_in_reverse_order_finalflaky:--stop-mergesfreezes mid-merge layoutsRoot cause: perf.py:909 freezes the layout at a moment the setup does not control. When the fill leaves merges in flight, the frozen part count depends on how far the merges got on each server before the stop. That contradicts the intent stated at perf.py:668-670 (both servers measure the layout the setup left).
read_in_reverse_order_final.xmldoes not opt out, and it does not pin its layout the wayfinal_read_in_order_limit.xmldoes (SYSTEM STOP MERGES <table>before its extra inserts).Affected locations:
tests/performance/scripts/perf.py:909—SYSTEM STOP MERGESright after the fill freezes a mid-merge layoutci/jobs/performance_tests.py:1286— this PR: the main runs pass--stop-mergestests/performance/read_in_reverse_order_final.xml:8— fill leaves dozens of parts still being merged; no table-levelSYSTEM STOP MERGES, nokeep_merges_runningWhy CI is needed: Every perf run whose shard includes
read_in_reverse_order_final, PR and master alike, now measuresFINALover a random 17-49-part layout that differs between the two servers. After the merge, 22.5% of runs gave a slower/unstable verdict that has nothing to do with the change under test, so the test can no longer separate a real change in the reverse-orderFINALread path from the layout difference. Measured for this test only.Suggested fix: - Pin the layout in the test, as
final_read_in_order_limit.xmldoes: makeSYSTEM STOP MERGES read_in_reverse_order_finalthe first fill query. Locally, two rounds both gave 54 parts, against 33-34 when merges were stopped after the fill. Trade-off: the test then measuresFINALover ~54 parts instead of the pre-PR 1-7, so its history resets.keep_merges_running="1"on<test>. This restores the pre-PR behaviour for this test only: merges keep running during the measurement.Assumptions
Unverified assumptions — tick to confirm, comment to refute:
SelectedPartsforread_in_reverse_order_finalinall-query-metrics.tsv.zstof more runs after the cut-off. A run without--stop-mergesshows 1-7 parts. All 7 post-merge runs sampled so far show 17-49.master_headbuild, which can be a few commits away from the PR build.SelectedPartsof theconfirm_changesrerun is not inall-query-metrics.tsv.--stop-mergesagainst two copies of the same binary and compareSelectedPartsandclient_timebetween them.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not applicable — temporary CI proof PR, will be closed automatically.
Documentation entry for user-facing changes
Workflow [PR]
Sync PR [sync-upstream/pr/122329]