Repository navigation
Conversation
The test relies on the queued async insert staying in `system.asynchronous_inserts` long enough for three follow-up `SELECT` queries from different users to observe it. To keep the entry in the queue, the `INSERT` sets `async_insert_busy_timeout_min_ms` and `async_insert_busy_timeout_max_ms` to 10 minutes. With the default `async_insert_use_adaptive_busy_timeout = 1`, the `max_busy_timeout_exceeded` shortcut inside `AsynchronousInsertQueue::pushImpl` (`src/Interpreters/AsynchronousInsertQueue.cpp`) fires when both `shard.last_insert_time + max_ms < now` and `flush_time_points.first + max_ms < flush_time_points.second` hold for the chosen queue shard, using the current query's `max_ms`. With our 10 minute `max_ms`, any shard that has been idle for longer than 10 minutes - common in a busy CI run, since each test run lands in a different shard via `key.hash` - matches both conditions, so our entry is moved to `data_to_process` and `shard.queue.erase(queue_it)` immediately. The subsequent `SELECT` queries then see zero rows. Smoking gun from the master CI server log (`https://s3.amazonaws.com/clickhouse-test-reports/REFs/master/a0a6cc08b5499fbf8c2ce88e554bdd9f7a929c23/stateless_tests_amd_msan_wasmedge_parallel_2_2/clickhouse-server.log.zst`, PR-induced sweep starting after `36fc6e58b55c` which dropped the test's `no-parallel` tag): AsynchronousInsertQueue: Asynchronous timeout increased from 2892 to 600000 for queue shard 13. AsynchronousInsertQueue: Have 1 pending inserts in shard 13 with total 4 bytes ... AsynchronousInsertQueue: Scheduling async insert processing job because maximum busy wait timeout exceeded AsynchronousInsertQueue: Processing batch insert ... AsynchronousInsertQueue: Flushed 1 rows, 8 bytes Setting `async_insert_use_adaptive_busy_timeout = 0` makes the lambda return on its first check, so the entry uses the fixed 10 minute deadline and survives until the `SELECT`s run. Verified locally with a deterministic reproducer (warm shard with two short-timeout flushes, then a long-timeout insert) - reproduces immediate drain with adaptive on, stays queued with adaptive off - and by running 50 iterations of the test at `-j 16` mixed with the other async-insert stateless tests: no failures. Failure was visible across 20+ CI runs in the 24h before this fix on `Stateless tests (amd_msan, WasmEdge, parallel)`, `(amd_tsan, parallel)`, `(amd_tsan, s3 storage, parallel)`, `(amd_debug, distributed plan, s3 storage, parallel)`, `(arm_asan_ubsan, targeted)`, and two `master` hits.
|
Pre-PR validation gate self-check: a) Deterministic repro? Yes. Local reproducer: warm a queue shard with two b) Root cause explained? Yes. c) Fix matches root cause? Yes. Setting d) Test intent preserved? Yes. The test still verifies that e) Both directions demonstrated? Yes. Without the fix the deterministic reproducer above shows f) Fix is general, not a narrow patch? This is a flaky-test setting pin, not a real code bug fix; the underlying adaptive-timeout optimization is correct for the production use case (low-latency batching with short Session id: cron:clickhouse-ci-task-worker:20260523-011500 |
|
cc @CheSema - could you review? Test-only setting pin for the async-insert queue test: 04043 was relying on a 10-minute busy_timeout to keep its entry in system.asynchronous_inserts, but the adaptive busy_timeout shortcut in pushImpl flushes it immediately on idle shards. Setting async_insert_use_adaptive_busy_timeout = 0 keeps the entry queued for the 600 s deadline. |
|
Workflow [PR], commit [c22e056] AI ReviewSummaryThe PR makes Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 481 line(s), 26 function(s) across 127 file(s) · Details Top files
|
|
Closing as superseded by master fix The master fix is a strict superset of mine:
CIDB: 0 master failures since Session: cron:clickhouse-ci-task-worker:20260526-024500 |
The test relies on the queued async insert staying in
system.asynchronous_insertslong enough for three follow-upSELECTs. To keep the entry in the queue, theINSERTsetsasync_insert_busy_timeout_min_ms = max_ms = 10 minutes.With the default
async_insert_use_adaptive_busy_timeout = 1, themax_busy_timeout_exceededshortcut inAsynchronousInsertQueue::pushImplfires when bothshard.last_insert_time + max_ms < nowandflush_time_points.first + max_ms < flush_time_points.second, using the current query'smax_ms. With our 10-minutemax_ms, any queue shard that has been idle for longer than 10 minutes - common in a CI run since each test run lands in a different shard viakey.hash- matches both conditions, so the entry is moved todata_to_processand removed fromshard.queueimmediately. The subsequentSELECTs then see zero rows.Smoking gun from master server log on
a0a6cc08b5499fbf8c2ce88e554bdd9f7a929c23after36fc6e58b55cdropped this test'sno-paralleltag:Setting
async_insert_use_adaptive_busy_timeout = 0makes the lambda return on its first check, so the entry uses the fixed 10-minute deadline and survives until theSELECTs run. Verified with a deterministic reproducer (warm a shard with two short-timeout flushes, then issue a long-timeout insert: reproduces immediate drain with adaptive on, stays queued with adaptive off) and by running 50 iterations of the test at-j 16mixed with the other async-insert stateless tests - no failures.Failures occurred across 20+ CI runs in the 24h before this fix on
Stateless tests (amd_msan, WasmEdge, parallel),(amd_tsan, parallel),(amd_tsan, s3 storage, parallel),(amd_debug, distributed plan, s3 storage, parallel),(arm_asan_ubsan, targeted), plus twomasterhits.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=a0a6cc08b5499fbf8c2ce88e554bdd9f7a929c23&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_msan%2C%20WasmEdge%2C%20parallel%2C%202%2F2%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Note
Low Risk
Low risk: only adjusts a stateless test to make async insert behavior deterministic; no production code changes.
Overview
Makes
04043_system_asynchronous_inserts_user_filter.shdeterministic by disabling adaptive async-insert busy timeout (--async_insert_use_adaptive_busy_timeout 0) and documenting why, so the queued insert reliably remains visible insystem.asynchronous_insertslong enough for the follow-up visibility assertions.Reviewed by Cursor Bugbot for commit c22e056. Bugbot is set up for automated code reviews on this repo. Configure here.