Skip to content

Fix flaky test 04043_system_asynchronous_inserts_user_filter - #100233

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-04043-flaky-test
Mar 21, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-04043-flaky-test

Conversation

@george-larionov

@george-larionov george-larionov commented Mar 20, 2026 •

Copy link
Copy Markdown
Member

Resolves #100231

Add no-parallel tag because the test relies on a pending async insert remaining in the queue. Concurrent tests that run
SYSTEM FLUSH ASYNC INSERT QUEUE drain all shards globally, removing the entry before the subsequent SELECT queries can observe it.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Version info

  • Merged into: 26.4.1.75

Add `no-parallel` tag because the test relies on a pending async insert
remaining in the queue. Concurrent tests that run
`SYSTEM FLUSH ASYNC INSERT QUEUE` drain all shards globally, removing
the entry before the subsequent SELECT queries can observe it.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8d9535d]

Summary: ✅


AI Review

Summary

This PR updates tests/queries/0_stateless/04043_system_asynchronous_inserts_user_filter.sh to add the no-parallel tag, preventing cross-test interference from global SYSTEM FLUSH ASYNC INSERT QUEUE calls that can drain pending async inserts and make the test flaky. The change is narrowly scoped, aligned with the stated issue, and I did not find correctness or safety regressions in the modified logic.

ClickHouse Rules

Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅

Final Verdict

  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 20, 2026
@george-larionov

Copy link
Copy Markdown
Member Author

@tiandiwonder

@george-larionov
george-larionov marked this pull request as ready for review March 20, 2026 20:44
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Mar 20, 2026
@alexey-milovidov alexey-milovidov self-assigned this Mar 20, 2026
Merged via the queue into master with commit 419710e Mar 21, 2026
148 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-04043-flaky-test branch March 21, 2026 00:05
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 21, 2026
pull Bot pushed a commit to sowelswl/ClickHouse that referenced this pull request May 25, 2026
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 ClickHouse#103032 dropped the `no-parallel` tag added in ClickHouse#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=
DavidHe-2008 pushed a commit to DavidHe-2008/ClickHouse that referenced this pull request Jun 1, 2026
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 ClickHouse#103032 dropped the `no-parallel` tag added in ClickHouse#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=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: 04043_system_asynchronous_inserts_user_filter

3 participants