Repository navigation
Fix flaky 04633_async_insert_select_general (no deadline on the wait_for_async_insert=0 poll) - #124263
Conversation
…for_async_insert=0 poll Case 4 inserts with `async_insert=1&wait_for_async_insert=0` and then polled `count()` 20 times (about 19 s on the arm_asan_ubsan azure lane) before printing the rows. `wait_for_async_insert=0` gives no visibility deadline, and on ClickHouse#119181 the background flush took 27.4 s, 27.1 s of it waiting for the filesystem cache priority lock while writing a 2-row part to the write-through `cached_azure` disk (Azure writes took 5 ms). The rows landed 8 s after the final SELECT, so the reference diff was caused only by the 20-iteration cap. Loop until the rows land instead. The runner's per-test timeout stays the bound, so a lost insert still fails. Same remedy as ClickHouse#123897. 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 (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261006-155500 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261006-152700 |
|
Workflow [PR], commit [3e98dd7] Summary: ✅ AI ReviewSummaryThis PR removes the arbitrary 20-iteration polling deadline from case 4 of Final Verdict
|
| ${CLICKHOUSE_CURL} -sS -X POST \ | ||
| "${CLICKHOUSE_URL}&async_insert=1&wait_for_async_insert=0&query=${Q}" -d "" | ||
|
|
||
| for _ in $(seq 1 20); do |
There was a problem hiding this comment.
Yes, deliberately. With wait_for_async_insert=0 nothing bounds when the flush finishes. On #119181 it started 1 ms after the INSERT and took 27.4 s, 27.1 s of that waiting for the filesystem cache priority lock on the write-through cached_azure disk, so the rows landed 8 s after the test's final SELECT. A fixed in-test bound only moves that threshold, so a lost insert now fails as this test's 600 s runner timeout.
SYSTEM FLUSH ASYNC INSERT QUEUE test_async_sel_wait would not make it deterministic: the table-scoped flush waits only for batches it takes from the queue itself, and this batch was already scheduled (AsynchronousInsertQueue::flush). If you prefer an explicit bound with a readable failure, I can switch to that.
Related: #119181
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix flaky test
04633_async_insert_select_general.Description
Case 4 of
04633_async_insert_select_general(an HTTPINSERT ... SELECTwithasync_insert=1&wait_for_async_insert=0) failed on #119181 with the twowait_*rows missing (report).The rows were not lost. In that job's logs the background flush started 1 ms after the
INSERTand took 27.4 s, 27.1 s of it waiting for the filesystem cache priority lock (FilesystemCachePriorityWriteLockMicroseconds) while writing a 2-row part to the write-throughcached_azuredisk; Azure writes took 5 ms. The test pollscount()only 20 times (about 19 s on that lane), so it printed nothing; the part committed 8 s after the finalSELECT.wait_for_async_insert=0gives no visibility deadline, so the 20-iteration cap checks nothing about the feature. The poll now loops until the rows land, and the runner's per-test timeout stays the bound, so a lost insert still fails. Same approach as #123897. Test-only, reference unchanged.Validation on a master debug build, with the case-4 table on a write-through cache disk and its part write held for 30 s by the
file_segment_pause_before_writefailpoint: the old test fails 3/3 with exactly the CI diff, the new one passes 3/3; with the write never released, the new test fails on the runner timeout. The fixed test passes 50/50 with randomized settings and 20/20 withlocal_cacheas the default storage policy.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124263]
Version info
26.10.1.1821-master(included in26.10and later)