Repository navigation
Fix flaky test 04043_system_asynchronous_inserts_user_filter - #105759
Merged
Merged
Conversation
The test was failing on master (and many open PRs) under sanitizer and S3 builds with both `secret_user sees:` and `admin sees:` returning 0 — i.e. the queued async insert was no longer in `system.asynchronous_inserts` by the time the user-filter `SELECT` queries ran. PR #103032 dropped the `no-parallel` tag added in #100233 on the premise that all unscoped `SYSTEM FLUSH ASYNC INSERT QUEUE` callers were migrated to the table-scoped variant. The premise holds for the tests that *call* flush, but this test does not call flush at all — it relies on the opposite: a pending entry must remain in the queue between `INSERT` and the three subsequent `SELECT` queries. Any concurrent unscoped flush drains it, and even without that there is a residual race in slow CI environments where the entry's visibility through `system.asynchronous_inserts` can lag the client return. Re-add `no-parallel` with a comment that captures the real reason (the test consumes pending state, it does not produce it), disable `async_insert_use_adaptive_busy_timeout` so the per-query 10-minute deadline is honored exactly and `max_busy_timeout_exceeded` cannot force an early flush when the shard has been idle, and poll `system.asynchronous_inserts` for up to 30 seconds before running the user-filter checks so the test fails clean on a real visibility bug instead of racing the queue. CI history: https://play.clickhouse.com/play?user=play#V0lUSAogICAgOTAgQVMgaW50ZXJ2YWxfZGF5cwpTRUxFQ1QKICAgIHRvU3RhcnRPZkRheShjaGVja19zdGFydF90aW1lKSBBUyBkYXksCiAgICBjb3VudCgpIEFTIGZhaWx1cmVzLAogICAgZ3JvdXBVbmlxQXJyYXkocHVsbF9yZXF1ZXN0X251bWJlcikgQVMgcHJzLAogICAgYW55KHJlcG9ydF91cmwpIEFTIHJlcG9ydF91cmwKRlJPTSBjaGVja3MKV0hFUkUgKG5vdygpIC0gdG9JbnRlcnZhbERheShpbnRlcnZhbF9kYXlzKSkgPD0gY2hlY2tfc3RhcnRfdGltZQogICAgQU5EIHRlc3RfbmFtZSA9ICcwNDA0M19zeXN0ZW1fYXN5bmNocm9ub3VzX2luc2VydHNfdXNlcl9maWx0ZXInCiAgICBBTkQgdGVzdF9zdGF0dXMgSU4gKCdGQUlMJywgJ0VSUk9SJykKICAgIEFORCAocHVsbF9yZXF1ZXN0X251bWJlciA9IDAgT1IgYmFzZV9yZWYgSU4gKCdtYXN0ZXInKSkKICAgIEFORCB0ZXN0X2NvbnRleHRfcmF3IExJS0UgJyVyZXN1bHQgZGlmZmVycyB3aXRoIHJlZmVyZW5jZSUnCkdST1VQIEJZIGRheQpPUkRFUiBCWSBkYXkgREVTQwo=
Contributor
|
Workflow [PR], commit [c9fe327] Summary: ✅ AI ReviewSummaryThe PR stabilizes Final VerdictStatus: ✅ Approve |
Contributor
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 396 line(s), 14 function(s) across 110 file(s) · Details Top files
|
Algunenano
reviewed
May 25, 2026
| ${CLICKHOUSE_CLIENT} \ | ||
| --user "secret_user_${CLICKHOUSE_DATABASE}" \ | ||
| --async_insert 1 \ | ||
| --async_insert_use_adaptive_busy_timeout 0 \ |
Member
There was a problem hiding this comment.
This was the only change that was necessary. All the rest is noise.
DavidHe-2008
pushed a commit
to DavidHe-2008/ClickHouse
that referenced
this pull request
Jun 1, 2026
Fix flaky test `04043_system_asynchronous_inserts_user_filter`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test ensures
system.asynchronous_insertsdoes not leak insertmetadata across users. To exercise the visibility filter it needs a
pending async insert to actually be in the queue while the user-filtered
SELECTqueries run, and it has been flaking with bothsecret_user sees:andadmin sees:returning 0 - i.e. the entry was no longer inthe queue when the
SELECTqueries ran.PR #103032
dropped the
no-paralleltag added in#100233 on the
basis that every test that called
SYSTEM FLUSH ASYNC INSERT QUEUEhadbeen migrated to the table-scoped variant. That is correct for the
tests that call flush, but this test does the opposite - it depends
on a pending entry remaining in the queue between the
INSERTand thethree subsequent
SELECTqueries. Any concurrent unscoped flush drainsit, and even isolated reruns on sanitizer builds can race the entry's
visibility through
system.asynchronous_inserts.The fix:
no-parallelwith a comment that captures the real reason(the test consumes pending state, it does not produce it).
async_insert_use_adaptive_busy_timeoutso the per-query10-minute deadline is honored exactly and
max_busy_timeout_exceededcannot force an early flush when the shard has been idle for a long
time.
system.asynchronous_insertsfor up to 30 seconds beforerunning the user-filter checks so the test fails clean on a real
visibility regression instead of racing the queue.
CI history of the failure:
https://play.clickhouse.com/play?user=play#V0lUSAogICAgOTAgQVMgaW50ZXJ2YWxfZGF5cwpTRUxFQ1QKICAgIHRvU3RhcnRPZkRheShjaGVja19zdGFydF90aW1lKSBBUyBkYXksCiAgICBjb3VudCgpIEFTIGZhaWx1cmVzLAogICAgZ3JvdXBVbmlxQXJyYXkocHVsbF9yZXF1ZXN0X251bWJlcikgQVMgcHJzLAogICAgYW55KHJlcG9ydF91cmwpIEFTIHJlcG9ydF91cmwKRlJPTSBjaGVja3MKV0hFUkUgKG5vdygpIC0gdG9JbnRlcnZhbERheShpbnRlcnZhbF9kYXlzKSkgPD0gY2hlY2tfc3RhcnRfdGltZQogICAgQU5EIHRlc3RfbmFtZSA9ICcwNDA0M19zeXN0ZW1fYXN5bmNocm9ub3VzX2luc2VydHNfdXNlcl9maWx0ZXInCiAgICBBTkQgdGVzdF9zdGF0dXMgSU4gKCdGQUlMJywgJ0VSUk9SJykKICAgIEFORCAocHVsbF9yZXF1ZXN0X251bWJlciA9IDAgT1IgYmFzZV9yZWYgSU4gKCdtYXN0ZXInKSkKICAgIEFORCB0ZXN0X2NvbnRleHRfcmF3IExJS0UgJyVyZXN1bHQgZGlmZmVycyB3aXRoIHJlZmVyZW5jZSUnCkdST1VQIEJZIGRheQpPUkRFUiBCWSBkYXkgREVTQwo=
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix flaky test
04043_system_asynchronous_inserts_user_filter.Documentation entry for user-facing changes
Version info
26.6.1.124