Skip to content

Run the setup INSERTs of 03822_variant_distinct_filter synchronously - #125201

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/03822-sync-setup-inserts
Oct 12, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/03822-sync-setup-inserts

Conversation

@groeneai

@groeneai groeneai commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #110015

Changelog category (leave one):

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

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Description

03822_variant_distinct_filter hit the 300 s per-test timeout in Stateless tests (arm_binary, AsyncInsert, s3 storage, parallel) on #110015 (CI report). It was not a hang. The job's query_log shows that 63 of the 80 setup INSERTs had finished, taking 3.5 to 5 s each, and the concurrent SELECT phase never started.

The AsyncInsert jobs enable async_insert in the server profile, with the default wait_for_async_insert = 1, and tests/config/users.d/timeouts.xml sets the busy timeout to 5000 ms. The test sends its 80 INSERTs one at a time through one client, so each INSERT waits for its own queue flush. The adaptive busy timeout is tracked per queue shard, and inserts from other tests on the same shard keep it close to the 5000 ms maximum. The setup alone can then take about 80 x 5 s. In master runs of this check, 5 of 80 runs in the last 30 days took over 300 s (max 388 s). They passed only because the master per-test timeout is 600 s.

The concurrent SELECTs need 80 separate Memory blocks, not async inserts, so the setup batch now runs with --async_insert=0. Every non-AsyncInsert job already runs it that way. The SELECT phase is unchanged, and the test still runs in the AsyncInsert jobs.

Validation on a local debug server with the AsyncInsert profile: with the busy timeout forced to its maximum (async_insert_use_adaptive_busy_timeout=0), the old test hits a 90 s timeout after 17 INSERTs of 5.0 s each, and the new test passes in 5.5 s (80 INSERTs, max 1 ms). The setup still creates 80 rows in 80 blocks. 50 of 50 randomized runs pass with the AsyncInsert profile (max 6.2 s), and 20 of 20 with the default profile.


Workflow [PR]
Sync PR [sync-upstream/pr/125201]

Version info

  • Merged into: 26.10.1.2233-master (included in 26.10 and later)

In the AsyncInsert jobs the server profile enables async_insert with the
default wait_for_async_insert = 1, and timeouts.xml sets the busy timeout
to 5000 ms. The test sends its 80 setup INSERTs one at a time, so each one
waits for its own queue flush. The adaptive busy timeout is per queue
shard, and other tests' inserts on the same shard keep it near the
5000 ms maximum, so the setup alone can take about 80 x 5 s. That hit the
300 s per-test timeout on ClickHouse#110015. In master and release-branch runs of
the same check, 5 of 80 runs in 30 days took over 300 s.

The concurrent SELECTs only need 80 separate Memory blocks, so run the
setup batch with --async_insert=0, as every other job already does. The
SELECT phase is unchanged and the test still runs in the AsyncInsert jobs.
A no-async-insert tag would skip the whole test there instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Oct 11, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 finding) plus my own review (2 nits).

# Sev Finding Verdict Evidence / action
1 ⚠️ The test does not assert that its setup INSERTs run synchronously; add throwIf(getSetting('async_insert')) DISAGREE A client-side setting beats the server profile (ClientBase::applySettingsFromServerIfNeeded), so the flag cannot be silently ignored; measured 4000 of 4000 setup INSERTs with async_insert = 0 in 50 randomized AsyncInsert runs. None of the 35 in-tree tests with a per-call --async_insert=0 self-assert it.
2 💡 PR text: the 80 master-side runs are all master; the CI INSERTs took 3.5 to 5 s, not all 5 s AGREE Description wording corrected.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-8:20261011-140500

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. AsyncInsert profile (enable_async_inserts.xml + timeouts.xml) on a local debug server, --client-option async_insert_use_adaptive_busy_timeout=0 (busy timeout forced to its 5000 ms max): the unmodified test times out at 90 s every time, 17 INSERTs of 5.0 s each.
b Root cause explained? The 80 setup INSERTs are sent one at a time with async_insert=1 and wait_for_async_insert=1, so each waits for its queue flush. The flush deadline is the queue shard's adaptive busy timeout (up to 5000 ms), which neighbouring tests' inserts keep near the maximum in the parallel job: about 80 x 5 s of setup.
c Fix matches root cause? Yes. The setup batch runs with --async_insert=0 and no longer waits on the queue. No timeout, tag, bound or data-size change.
d Test intent preserved / new tests added? Yes. The concurrent SELECT phase is unchanged, the setup still produces 80 rows in 80 Memory blocks (uniqExact(blockNumber()) = 80, negative control 1), and the test keeps running in the AsyncInsert jobs. Test-only change.
e Both directions demonstrated? Yes. Forced-max arm: base FAIL (90 s timeout, INSERTs 5002-5012 ms), fix OK in 5.5 s (80 INSERTs, max 1 ms, async_insert=0).
f Fix is general across code paths? N/A (test-only change).
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only change). Randomized settings: 50/50 OK with the AsyncInsert profile (max 6.2 s), 20/20 OK with the default profile.
h Backward compatible? (maintainer-approved exception only) N/A (test-only change, no setting or format change).
i Invariants and contracts preserved? The test's invariant (80 separate Memory blocks before the concurrent SELECTs) holds with both profiles.

Session id: cron:clickhouse-impl-slot-5:20261011-134300

@clickhouse-gh

clickhouse-gh Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a4bc0d1]

Summary: ✅


AI Review

Summary

This PR makes the setup phase of 03822_variant_distinct_filter opt out of async_insert so the AsyncInsert stateless job no longer spends one busy-timeout window per setup INSERT, while keeping the concurrent SELECT phase unchanged. I do not see a correctness or coverage regression in the current diff.

Final Verdict

✅ No blocking or major issues found. No new inline review comments to post.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 11, 2026
@groeneai
groeneai requested a review from CheSema October 11, 2026 14:26
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 11, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 12, 2026
Merged via the queue into ClickHouse:master with commit 5b88823 Oct 12, 2026
173 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
@clickhouse-gh clickhouse-gh Bot added comp-data-types Type system & core datatypes used across query planning/execution. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-data-types Type system & core datatypes used across query planning/execution. groeneai-origin-request PR origin: a maintainer pinged or directed groeneai 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.

3 participants