Skip to content

Refactor canceling queries with url() function - #104014

Merged
murphy-4o merged 5 commits into
ClickHouse:masterfrom
arenadata:ADQM-4491
May 5, 2026
Merged

murphy-4o merged 5 commits into
ClickHouse:masterfrom
arenadata:ADQM-4491

Conversation

@rvasin

@rvasin rvasin commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

It's refactoring follow up to #102801

Version info

  • Merged into: 26.5.1.268

@rvasin

rvasin commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

@murphy-4o please set can be tested label and assign yourself to this PR.

@vdimir vdimir added the can be tested Allows running workflows for external contributors label May 4, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b5afa51]

Summary: ✅


AI Review

Summary

This PR refactors cancellation plumbing for url reads by passing CheckCancelled through StorageURLSource::getFirstAvailableURIAndReadBuffer and consolidates two shell tests into a single parameterized test for HEAD/GET cancellation paths. I did not find correctness, safety, or performance issues in the current diff, and the selected Changelog category (Not for changelog) matches the change scope.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label May 4, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.00% -0.10%
Functions 91.10% 91.10% +0.00%
Branches 76.60% 76.50% -0.10%

Changed lines: 100.00% (14/14) · Uncovered code

Full report · Diff report

@murphy-4o
murphy-4o added this pull request to the merge queue May 5, 2026
Merged via the queue into ClickHouse:master with commit 660cf75 May 5, 2026
165 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label May 5, 2026
alexey-milovidov pushed a commit that referenced this pull request May 5, 2026
This reverts commit 660cf75, reversing
changes made to d7cd1bc.
pull Bot pushed a commit to weiyilai/ClickHouse that referenced this pull request Sep 26, 2026
Check query cancellation between HTTP retry attempts, so that `KILL QUERY`
and client disconnects stop a query over the `url` table function instead of
waiting until all the retries are exhausted.

`ReadWriteBufferFromHTTP` accepts an optional cancellation callback and, from
the second attempt on, leaves `doWithRetries` by `break` instead of throwing,
so the original HTTP error is still reported on the first attempt.
`StorageURLSource` passes `isCancelled` down to the buffer and checks for
cancellation after every step of its lazy initialization that can issue an
HTTP request.

This is a resubmission of ClickHouse#104089
by Roman Vasin (@rvasin) into the main repository, so that we can continue to
work on it. That pull request in turn fixes the reverted
ClickHouse#102801 and
ClickHouse#104014.

Differences from the original pull request: a comment in
`ReadWriteBufferFromHTTP::initialize` that a bad merge had garbled is restored,
the condition of the `chassert` in `readBigAt` is parenthesized, and the test is
renumbered to `04615` because `04078` is taken on `master`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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 pr-not-for-changelog This PR should not be mentioned in the changelog 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