Repository navigation
[jdbc-v2, client-v2] Document the effect of wait_end_of_query - #3397
Merged
Merged
Conversation
The driver does not set wait_end_of_query, so the server default 0 applies and result sets stream. Document what changes with wait_end_of_query=1: first-row latency, the server-side temporary file, complete X-ClickHouse-Summary statistics, and how an error during a query reaches the application. Document how to enable it per connection and per statement, and why it must be the URL parameter (readonly profiles accept it; the SETTINGS clause cannot enable it). Also fix the Javadoc of QuerySettings#waitEndOfQuery, describe it in the client-v2 QuerySettings table and the response metrics section, and add the reviewed default to the jdbc-v2 compatibility traits. Implements: #2830 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Auto-approved by the AI review gate on f286335. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
chernser
approved these changes
Nov 23, 2026
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.
Summary
Closes #2830
I explored the effect of
wait_end_of_queryon jdbc-v2 against ClickHouse 26.10.4 (curland the driver built frommain). Result: keep the current default. No code change is necessary. The driver does not set the parameter, so the server default0applies and result sets stream. This PR documents when to usewait_end_of_query=1and what it costs.Findings
wait_end_of_query=0(default)wait_end_of_query=1SELECTof 50M rows: time to first byte / totalExternalProcessingFilesTotal=1). With the defaulthttp_response_buffer_size=0, this also occurs for a 1-rowSELECTand for anINSERT.X-ClickHouse-Summaryof aSELECTread_rows=65409of 50M,result_rows=0(also0for a 1000-row result)executeUpdate/executeBatchcount (INSERT VALUES,INSERT SELECT10M, TSV body 1M,DELETE)throwIfat row 200000)next()returns rows, then throwsSQLExceptionHY000, code 0, "Failed to read value for column r".executeQuerythrowsSQLExceptionwith code 395 and the server message. No rows.Other results:
wait_end_of_queryis an HTTP parameter that the server reads before it parses the query. It is not a setting:readonly=1user can send it. The setting namehttp_wait_end_of_queryfails withREADONLY(164).SETTINGS wait_end_of_query=1in the SQL fails withUNKNOWN_SETTING, andSETTINGS http_wait_end_of_query=1does not cause buffering.http_wait_end_of_query=1in a user profile causes buffering, and the URL parameter overrides it.((StatementImpl) stmt).getLocalSettings().waitEndOfQuery(true)works forStatementandPreparedStatement.=1, asocket_timeoutshorter than the query ends the request before the first row.compresson and off), the last 3–20 rows thatResultSet.next()returned before the exception had wrong values. The client reads a part of the server's exception block as row data. The root cause is the one in #2702, and open PR #3097 fixes it. This PR documents the current behavior. When #3097 merges, the sentence "The last of these rows can have wrong values" injdbc.mdxmust be removed. Applications that must not process wrong rows can usewait_end_of_query=1until then.Changes
docs/clickhouse-docs/jdbc.mdx: new section "Waiting for the End of a Query" (#wait-end-of-query). It tells how to enable the parameter per connection, in the URL and per statement, and why it must be the URL parameter. It has a table of the effects and recommendations.docs/clickhouse-docs/client.mdx: describesQuerySettings#waitEndOfQuery(including thequeryRecords/queryAllmethods that always set it), adds a note to "Response Metrics API" that query server metrics are partial without it, and adds a reference in the v1 migration table.QuerySettings#waitEndOfQueryJavadoc: fixes the typo ("the and of the query") and describes the effect.docs/features.md: one jdbc-v2 compatibility trait that records the reviewed default. It is next to theasync_inserttrait.Compatibility
There is no behavior change, no public API change, and no change to a default. The Javadoc is the only change in a
.javafile.docs/changes_checklist.md: no section applies (no logging, enum, method, configuration property, default, exception, retry, or output change). I added no CHANGELOG fragment underhistory/latest/, because docs-only PRs in this repository do not add one.Verification
mvn -pl client-v2 compile javadoc:javadoc: BUILD SUCCESS, no new warning.jdbc.mdxhas the same number of columns in each row. The link and anchor forms are the same as the forms that these files use now. The Mintlify check runs in CI.Statement,PreparedStatementandexecuteBatch; raw HTTP withsystem.query_logProfileEvents). They are not part of the PR.Checklist
docs/clickhouse-docspages in this repo sync to clickhouse-docs)🤖 Generated with Claude Code
Note
Low Risk
Docs and Javadoc only; no runtime behavior, defaults, or API changes.
Overview
This PR is documentation-only (plus
QuerySettings#waitEndOfQueryJavadoc): it explains when and how to use the HTTP parameterwait_end_of_query/http_wait_end_of_query, with no driver or client default changes.docs/clickhouse-docs/jdbc.mdxadds "Waiting for the End of a Query", covering JDBC URL/connection properties (clickhouse_setting_wait_end_of_query), per-statementStatementImpl#getLocalSettings().waitEndOfQuery(true), readonly-profile pitfalls, and a behavior table (streaming vs buffered response, partialX-ClickHouse-Summary, error handling).docs/clickhouse-docs/client.mdxexpandswaitEndOfQueryin the QuerySettings table, notes thatqueryRecords/queryAllalways enable it, documents partial response metrics without it, and updates the v1 migration note forWAIT_END_OF_QUERY.docs/features.mdrecords jdbc-v2 compatibility around result streaming and this parameter.QuerySettingsJavadoc fixes a typo and describes buffering, complete metrics, and fail-before-rows semantics.Reviewed by Cursor Bugbot for commit f286335. Bugbot is set up for automated code reviews on this repo. Configure here.