Skip to content

Make INSERT ... SELECT compatible with async insert - #111663

Merged
Felixoid merged 34 commits into
masterfrom
async-insert-select-processor
Sep 27, 2026
Merged

Felixoid merged 34 commits into
masterfrom
async-insert-select-processor

Conversation

@Felixoid

@Felixoid Felixoid commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

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

Async insert now supports eligible single-block local INSERT ... SELECT queries, with synchronous fallback for larger, multi-block, empty, transactional, or non-parallel-quorum inserts.

Performance note

The new insert_select_async_insert_queue shows apparent degradation because of synchronous routing on the master. Async insert with wait shows expected overhead.


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

Version info

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

@clickhouse-gh

clickhouse-gh Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9b4a713]

Summary: ✅


AI Review

Summary

This PR teaches eligible single-block local INSERT ... SELECT queries to use the asynchronous insert queue, keeps the existing synchronous path as a fallback for unsupported cases, and adds broad regression coverage plus user documentation for the new routing/accounting rules. I did not find a new inline issue in the current revision, but one previously raised shared async-insert queue bug still remains real and still affects this feature once it enters the common queue path.

Findings
  • ⚠️ Major: [dismissed by author -- https://github.com/Make INSERT ... SELECT compatible with async insert #111663#discussion_r4063914096] The async flush still restores only the user-name strings, not the access-relevant ClientInfo fields (interface, http_method, current_address, forwarded_for, quota_key) that ContextAccessParams uses for quota/access evaluation. Two queued inserts from the same user but different quota_key or client-address context can still coalesce and then flush under the wrong quota/access context. I agree this predates the feature and is not newly introduced here, but it still affects the new async INSERT ... SELECT route because it shares the same queue/flush machinery.
Final Verdict

⚠️ No new inline findings for the current diff. The only remaining concern from this review pass is the pre-existing shared async-insert context bug above, which the author explicitly scoped out of this PR and linked to follow-up work in #122296.

LLVM Coverage Report

Measured on commit 9b4a713.

Metric Baseline Current Δ
Lines 88.20% 88.20% +0.00%
Functions 91.70% 91.80% +0.10%
Branches 79.60% 79.60% +0.00%

Changed lines: Changed C/C++ lines covered: 433/464 (93.32%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jul 23, 2026
@mintlify

mintlify Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Sep 27, 2026, 11:14 AM

@Felixoid
Felixoid force-pushed the async-insert-select-processor branch 2 times, most recently from d368c1b to aa90e8e Compare July 24, 2026 11:38
@Felixoid
Felixoid force-pushed the async-insert-select-processor branch from b4bbc5a to ee5d636 Compare July 24, 2026 14:45
@clickgapai

Copy link
Copy Markdown
Contributor

@Felixoid — this PR looks backward incompatible but is categorized as Improvement.

Why: async_insert_select_as_async_insert ships with history {"26.10", false, true} on top of async_insert = 1 by default, and the diff deletes the documented guarantee that INSERT ... SELECT is always synchronous regardless of async_insert. Existing queries change behaviour on upgrade: NOT_IMPLEMENTED in transactions, fire-and-forget under wait_for_async_insert = 0, currentDatabase() defaults.

Suggested category: Backward Incompatible Change. Ignore if the change is intentionally non-breaking.

This branch was successfully deployed

1 active deployment
staging - docs — 9b4a7139 Deployed Sep 27, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-async-insert Asynchronous INSERT buffering/queueing and flush semantics. pr-improvement Pull request with some product improvements 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.

4 participants