Repository navigation
fix: do not derive max_execution_time from the context deadline - #2101
Conversation
Fixes ClickHouse#2100 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 Claude reviewStops What is sound:
Key concerns:
Blind spots: could not run the integration test against a live server. On HTTP, Verdict: General findings
Inline comments are attached to the relevant lines. This summary updates in place on re-review. |
The context deadline only limits how long the client waits. The driver no longer sets max_execution_time from it, so a value set on the context, the connection, the DSN or the server profile reaches the server unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chernser
left a comment
There was a problem hiding this comment.
thank you for updating the documentation!
Summary
Fixes #2100.
When the context has a deadline, the driver set
max_execution_timeto the deadline + 5s. This replaced amax_execution_timeset on the context, the connection, the DSN or the server profile. So the server could run a query longer than the limit the user set.The driver now does not derive
max_execution_timefrom the context deadline. The deadline only limits how long the client waits. The server uses themax_execution_timethe user or the DB admin sets.Behaviour change:
max_execution_timeorcancel_http_readonly_queries_on_client_closeis set. Over Native, the driver still sends a cancel when the context ends.max_execution_time(for example60, as in the README) now applies also when the context deadline is longer. Before, the deadline + 5s replaced it.Checklist
TestQueryOptionsMaxExecutionTime: a deadline does not addmax_execution_time, and does not change a value that is set (also0).tests/issues/issue_2100_test.go: Native and HTTP. With a 1 minute deadline, the server gets the samemax_execution_timeas without a deadline: not set, set on the context, and set on the connection.docs/config-reference.mdx: the deadline note now says that the deadline only limits the client.🤖 Generated with Claude Code
Note
Medium Risk
Behavior change: queries may continue on the server after the client context expires unless
max_execution_timeis set (HTTP in particular); callers who relied on deadline-derived server limits need to setmax_execution_timeexplicitly.Overview
Fixes #2100 by removing logic in
queryOptionsthat auto-set ClickHousemax_execution_timefrom a context deadline (remaining seconds + 5), which could override limits from DSN, connectionSettings, or per-queryWithSettings.Context deadlines now only cap client wait time; server query duration is controlled only by explicit
max_execution_time(or other server settings). Docs inconfig-reference.mdxare updated to match, including clarifying thatmax_execution_time=0means the server does not auto-stop the query.Adds unit tests (
TestQueryOptionsMaxExecutionTime) and integration tests (issue_2100_test.gofor Native and HTTP) to ensure a 1-minute context deadline does not change themax_execution_timethe server sees.Reviewed by Cursor Bugbot for commit 8721a42. Bugbot is set up for automated code reviews on this repo. Configure here.