[v0.10.0-rc1] Request Cancellation#2912
Conversation
…us code to be more certain about codes
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
extend AGENTS.md based on CONTIBUTING.md
|
Repository collaborators can run the JMH benchmark suite against this PR by commenting: Optional regression threshold override (Δ% on Time or Alloc/op; defaults to 10%): Only one benchmark run per PR is active at a time — issuing a new |
TriageCategory: Summary What this impacts
Concerns
Required reviewer action
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1ed667d. Configure here.
| private void unregisterTransportReq(String queryId) { | ||
| if (queryId != null) { | ||
| ongoingRequests.remove(queryId); | ||
| } |
There was a problem hiding this comment.
Duplicate queryId breaks cancellation map
High Severity
The ongoingRequests map uses queryId as a unique key. This means concurrent operations with the same queryId will overwrite each other's entries. When one operation finishes, its cleanup removes the queryId, potentially unregistering a still-active request. As a result, cancelTransportRequest may fail to target the correct ongoing request.
Reviewed by Cursor Bugbot for commit 1ed667d. Configure here.
| TransportRequest tr = ongoingRequests.get(queryId); | ||
| return tr == null || !tr.isCancelled(); | ||
| } | ||
| return true; |
There was a problem hiding this comment.
Cancel ignored between retry attempts
Medium Severity
The cancelTransportRequest method doesn't reliably stop retried operations. For inserts, TransportRequest entries are removed from ongoingRequests after each attempt, and for queries, they're replaced. This causes requestIsNotCancelled to incorrectly allow retries to proceed even after a cancellation attempt.
Reviewed by Cursor Bugbot for commit 1ed667d. Configure here.
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|





Summary
This PR implement client API to cancel request by original
queryId.What request cancellation means from client side is ability to interrupt outgoing network request when it is not needed any more. In most cases it is implemented with timeouts on client and server side. However there are cases when request should be cancelled before timeout (new data arrived, for instance).
JDBC in this case has request cancellation by sending
KILL QUERY. This guarantees to interrupt request. JDBC requirescancelmethod by spec because only driver implementation knows how to handle it.Client in this case doesn't require a
cancelmethod because query can be constructed in preferable by user way. Client, however, can provide method to try canceling network request by interrupting IO operation.This PR does implement request cancellation on client level. Implementation is based on the fact that each request correlates to a
queryId. User can specify it. Internally client stores map betweenqueryIdand request object that should be cancelled.Closes #1760
Closes #2802
Checklist
Delete items not relevant to your PR: