Skip to content

Fix INSERT into OneLake DataLakeCatalog table (route ADLS Gen2 writes to the .dfs host) - #110290

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
zlareb1:onelake-insert-dfs-fix
Jul 20, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
zlareb1:onelake-insert-dfs-fix

Conversation

@zlareb1

@zlareb1 zlareb1 commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

INSERT into a Microsoft Fabric / OneLake DataLakeCatalog table failed during the data-file upload with IncorrectEndpointError (HTTP 400): OneLake reads use the Blob endpoint, so the ADLS Gen2 (DFS) write client built the file URL against the .blob host, which does not serve the DFS filesystem API.

  • Route DFS writes to the .dfs host in buildAdlsGen2FileUrl (reads stay on .blob), matching only real Fabric hosts at a domain-label boundary — same tightening in isAdlsGen2Endpoint.
  • Validate the actual request host against remote_url_allow_hosts in PocoAzureHTTPClient, so a .dfs write can't bypass an allowlist that only lists the .blob read host.
  • Add gtests for the URL rewrite and the allowlist re-check. The e2e test_insert_into_table[onelake] (internal pipeline only) now asserts the INSERT commits and reads back a real value.

Note for hardened deployments: OneLake reads use onelake.blob.fabric.microsoft.com and writes use onelake.dfs.fabric.microsoft.com. If host access is restricted via remote_url_allow_hosts, both hosts must be allowlisted — otherwise CREATE/reads succeed but INSERT is rejected with UNACCEPTABLE_URL. This is documented in the onelake_use_blob_endpoint setting description. (Not validated at CREATE time on purpose, so read-only deployments that only need the .blob host are not regressed.)

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fixed INSERT into a Microsoft Fabric / OneLake DataLakeCatalog table failing with IncorrectEndpointError (HTTP 400) by routing ADLS Gen2 (DFS) writes to the .dfs endpoint host instead of the .blob host. Note: with remote_url_allow_hosts, both the .blob (read) and .dfs (write) Fabric hosts must be allowlisted for INSERT.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

🤖 Generated with Claude Code

Version info

  • Merged into: 26.7.1.1226 (included in 26.7 and later)

@zlareb1
zlareb1 marked this pull request as ready for review July 13, 2026 16:40
@clickhouse-gh

clickhouse-gh Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ba7ebb2]

Summary: ✅


AI Review

Summary

This PR fixes the OneLake DataLakeCatalog write path by retargeting ADLS Gen2 writes from the Fabric .blob host to the .dfs host, re-checking the effective request host against remote_url_allow_hosts, and adding focused public regression tests plus the private e2e coverage mentioned in the PR. I did not find a remaining correctness, compatibility, or test-coverage issue in the current head.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jul 13, 2026
@zlareb1
zlareb1 requested a review from scanhex12 July 15, 2026 05:51
@clickhouse-gh

clickhouse-gh Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 37 queries analysed

This PR only changes the OneLake/Azure DataLake write path (DFS host retargeting, request-time remote_url_allow_hosts enforcement) plus its unit/integration tests — none of which any ClickBench SELECT executes. Both flagged queries (Q4 and Q15) show a -18.1% "improvement," but each median lands inside master's current variance band and CPU time is essentially flat (Q4 2682.7→2652.0 ms, Q15 2595.2→2606.1 ms), so there is no work-backed speedup. The deterministic envelope suppression to no_change is correct: these are run-to-run variance, not effects of this change. No cross-query pattern and no real regression or improvement to act on.

clickbench

🟢 No significant changes

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 6969f580-6248-4621-bed3-7d1dc8fcb788
  • MIRAI run: deb0962b-c294-4833-92f7-6fcd534c2ca9
  • PR check IDs:
    • clickbench_426949_1784548860
    • clickbench_426963_1784548860
    • clickbench_426969_1784548860
    • tpch_adapted_1_official_426978_1784548860
    • tpch_adapted_1_official_426987_1784548860
    • tpch_adapted_1_official_427024_1784548860

… to the .dfs host)

INSERT into a Microsoft Fabric / OneLake `DataLakeCatalog` table failed during the
data-file upload with `IncorrectEndpointError` (HTTP 400): OneLake reads use the Blob
endpoint, so the ADLS Gen2 (DFS) write client built the file URL against the `.blob`
host, which does not serve the DFS filesystem API.

- Route DFS writes to the `.dfs` host in `buildAdlsGen2FileUrl` (reads stay on `.blob`),
  matching only real Fabric hosts at a domain-label boundary; same in `isAdlsGen2Endpoint`.
- Validate the actual request host against `remote_url_allow_hosts` in `PocoAzureHTTPClient`,
  normalized (scheme + lower-cased host) to match CREATE-time validation, so a `.dfs` write
  cannot bypass an allowlist.
- Document in the `onelake_use_blob_endpoint` setting that hardened deployments must
  allowlist both the `.blob` and `.dfs` hosts.
- Add gtests for the URL rewrite and the allowlist re-check.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@zlareb1
zlareb1 force-pushed the onelake-insert-dfs-fix branch from d368d82 to ba7ebb2 Compare July 15, 2026 17:02
@clickhouse-gh

clickhouse-gh Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 28.60% 85.90% +57.30%
Functions 39.40% 92.70% +53.30%
Branches 20.60% 78.00% +57.40%

Changed lines: Changed C/C++ lines covered: 89/89 (100.00%) · Uncovered code

Full report · Diff report

@fm4v fm4v self-assigned this Jul 20, 2026
@fm4v
fm4v added this pull request to the merge queue Jul 20, 2026
Merged via the queue into ClickHouse:master with commit 28fa939 Jul 20, 2026
175 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 20, 2026
@alesapin alesapin added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-must-backport Pull request should be backported intentionally. Use this label with great care! and removed pr-backport Changes, backported to release branch. Do not use manually - automated use only! labels Jul 30, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Jul 30, 2026
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Aug 9, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Fix INSERT into OneLake DataLakeCatalog table (route ADLS Gen2 writes to the .dfs host)
middas-0706 pushed a commit to middas-0706/ClickHouse that referenced this pull request Nov 5, 2026
Since ClickHouse#110290 every request of `PocoAzureHTTPClient` is checked against
`remote_url_allow_hosts`, including the requests of Azure disks, so a server
whose Azure disk endpoint is not in the list fails to start (ClickHouse#124431). S3
disks are not checked; only their redirects are.

Skip the request-host check for disk clients; redirects are still checked.
Let data lake tables on an Azure disk skip the URL check, as S3 disks do.
Keep the disk flag on the client returned by `CreateBlobContainer`, which the
SDK builds without `ClickhouseOptions`: otherwise the node that created the
container rebuilds its disk client as a non-disk one on the next config
reload, or on the first query of a data lake table on that disk.

A disk created by `disk(...)` in a query still has its endpoint checked, once
when it is created (not when it is loaded from existing metadata), so the
exemption does not reach hosts a query could not.

Closes ClickHouse#124431

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

6 participants