Repository navigation
Fix flaky test_parallel_quorum_actually_parallel - #103710
alexey-milovidov merged 1 commit into
Conversation
The test races: a 5-second `INSERT ... sleepEachRow(1)` runs in the
background while the test issues 8 client/server operations (2 quorum
inserts + 6 SELECT COUNT() assertions). Under sanitizer builds (`MSan`,
`TSan`, `ASan + UBSan`) those operations can take 10-20x longer than
on a release build, occasionally exceeding the 5-second window. When
that happens the long insert has already committed by the time the
test asserts `COUNT() == 2`, so it returns `7` instead and the test
fails:
assert node3.query("SELECT COUNT() FROM r") == "2\n"
AssertionError: assert '7\n' == '2\n'
This pattern accounts for 10 of the 16 chronic failures recorded in
CIDB over the last 30 days, including both master hits.
Triple the per-row sleep (1s -> 3s) so the long insert runs for 15s
total. The assertions still validate the same parallel-quorum
semantics; the test just gets a 3x safety margin against sanitizer
slowdowns. Locally reproduced the race deterministically by inserting
`time.sleep(1.5)` between operations, then confirmed the fix passes
with the same simulated slowdown.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100332&sha=&name_0=PR
Co-Authored-By: Claude Opus 4.7 <[email protected]>
Pre-PR validation gatea) Deterministic repro? Yes — reproduced locally by inserting b) Root cause explained? The test relies on a 5-second c) Fix matches root cause? Tripling d) Test intent preserved? Yes. The test still verifies parallel quorum inserts work concurrently with a long-running quorum insert. The semantics and assertions are unchanged — only the duration of the long insert is increased. e) Both directions demonstrated?
cidb-session: cron:clickhouse-ci-task-worker:20260429-081500 |
|
cc @tavplubix — could you review this? It tripples the per-row sleep duration in the long parallel-quorum INSERT (1s → 3s) so that the long insert reliably stays alive long enough for the test's COUNT()==2 assertions on sanitizer builds. Test-only change, no behavior modification. |
|
Workflow [PR], commit [f29ddc0] Summary: ✅ AI ReviewSummaryThis PR makes Missing context
ClickHouse Rules
Final Verdict
|
|
Backporting to fix CI |
Backport #103710 to 26.3: Fix flaky test_parallel_quorum_actually_parallel
The integration test
test_parallel_quorum_actually_parallelis chronically flaky on sanitizer builds — 16 hits across 11 PRs in the last 30 days, including 2 master hits.Root cause
The test starts a 5-second
INSERT ... numbers(5) WHERE sleepEachRow(1) == 0in a background pool, then issues 8 client/server operations on three replicas (2 quorum inserts + 6SELECT COUNT()assertions) and expectsCOUNT() == 2while the long insert is still running.Under
MSan,TSan, andASan + UBSanbuilds those operations can take 10-20x longer than on a release build. When the cumulative time exceeds the 5-second window, the long insert has already committed by the time the test assertsCOUNT() == 2, so it returns7instead:This pattern accounts for 10 of the 16 chronic failures recorded in CIDB over 30 days — including both master failures (
amd_msanandamd_asan_ubsan, db disk, old analyzer).Fix
Triple the per-row sleep (
sleepEachRow(1)→sleepEachRow(3)) so the long insert runs for 15 seconds total. The test's assertions and parallel-quorum semantics are unchanged; the fix just gives a 3x safety margin against sanitizer-induced slowdowns.Reproduction & verification
The race only manifests under heavy CI load, so I reproduced it locally by inserting
time.sleep(1.5)between the operations to simulate sanitizer overhead:sleepEachRow(1)+ simulated slowdown → reliably fails withassert '7\n' == '2\n'(matching the CI failure exactly)sleepEachRow(3)+ simulated slowdown → passessleepEachRow(3)without slowdown → passes in 36s (no measurable runtime regression)CI failure example: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100332&sha=&name_0=PR
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix flaky
test_parallel_quorum_actually_parallelintegration test on sanitizer builds.Documentation entry for user-facing changes
cidb-session: cron:clickhouse-ci-task-worker:20260429-081500
Version info
26.5.1.180-master(included in26.5and later)26.3.57.13