Skip to content

Fix HDFS storage type parsing in data lake catalogs - #112468

Merged
PedroTadim merged 14 commits into
ClickHouse:masterfrom
SaadIMC:fix/datalake-catalog-hdfs-storage-type
Nov 4, 2026
Merged

PedroTadim merged 14 commits into
ClickHouse:masterfrom
SaadIMC:fix/datalake-catalog-hdfs-storage-type

Conversation

@SaadIMC

@SaadIMC SaadIMC commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Data lake catalogs report HDFS table locations using the hdfs URI scheme, but DataLakeCatalog could not read such tables:

  1. Storage type parsing. tryParseStorageTypeFromString capitalized only the first character, producing Hdfs, which did not match StorageType::HDFS, so every HDFS table failed with Unsupported storage type: hdfs://. The lowercase hdfs scheme is now recognized explicitly; parsing of other storage types is unchanged.
  2. Vended credentials check. With the default vended_credentials = 1, buildTableEngineArgs threw BAD_ARGUMENTS because a REST catalog vends no credentials for HDFS. HDFS authenticates (e.g. with Kerberos) through the server's hdfs configuration rather than engine arguments, so HDFS tables are exempt from this check.
  3. Source access and writes. HDFS is accessed with the server's own identity. Reading an HDFS-located catalog table requires the same READ ON HDFS grant as icebergHDFS, with filters matched against the same URI: the HDFS authority (e.g. READ ON HDFS('hdfs://namenode:9000')), not the full table location. The check runs before a storage is built or returned from the stateful-table cache, so it covers SELECT and the metadata read behind DESCRIBE. Writes reach HDFS through too many entry points to authorize each one, so these tables are read-only: their HDFSObjectStorage rejects every write and removal with READONLY. For the same reason they never use the stateful table path, whose background compaction would write to HDFS.

Tests:

  • An integration test (test_database_iceberg_hdfs_location) with a mock REST catalog that advertises an hdfs:// location on a real HDFS:
    • It checks SHOW CREATE TABLE, DESCRIBE and SELECT under default settings.
    • A restricted user with no READ ON HDFS grant, or a grant filtered to another HDFS authority, is denied. A grant matching the authority (hdfs://hdfs1:9000) is allowed.
    • Synchronous, asynchronous and parallel-replicas inserts fail with READONLY, and the table directory on HDFS is unchanged.
    • With allow_experimental_iceberg_compaction = 1, reads still work and no background READONLY errors appear.

Closes: #128188

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):

DataLakeCatalog databases can now read tables whose catalog location is on HDFS (hdfs://), including with the default vended_credentials setting. Reading requires the same READ ON HDFS grant as icebergHDFS (filters match the HDFS authority, e.g. hdfs://namenode:9000). Such tables are read-only; writes fail with READONLY.


Workflow [PR]
Sync PR [sync-upstream/pr/112468]

Version info

  • Merged into: 26.11.1.1338-master (included in 26.11 and later)

@CLAassistant

CLAassistant commented Jul 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Manerone Manerone added the can be tested Allows running workflows for external contributors label Jul 30, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8332f77]

Summary: ✅


AI Review

Summary

DataLakeCatalog now resolves HDFS locations with the default vended_credentials setting, requires READ ON HDFS, blocks ClickHouse-side HDFS writes and removals, and excludes HDFS tables from background compaction. No new actionable findings in PR head 8332f7746c24d19561fff0fc5b8e224bc98c77cd. Earlier findings are addressed; the author's distinction between catalog-authorized operations and ClickHouse-side HDFS I/O is accepted.

Missing context / blind spots
  • ⚠️ The current-head Praktika workflow is still running, with targeted integration and integration bugfix-validation jobs pending. The report helper's “all-green” label does not mean these jobs passed. Passing results for the four tests in test_database_iceberg_hdfs_location would close this execution gap. No local build or tests were run.
Final Verdict

Status: ✅ Approve — no outstanding code-review findings; required CI must complete successfully before merge.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jul 30, 2026
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
@SaadIMC
SaadIMC force-pushed the fix/datalake-catalog-hdfs-storage-type branch from 312a535 to 89a3f8d Compare July 30, 2026 15:05
@scanhex12 scanhex12 self-assigned this Jul 30, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.40% 86.50% +0.10%
Functions 91.80% 91.90% +0.10%
Branches 78.50% 78.60% +0.10%

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

Full report · Diff report

@clickhouse-gh

clickhouse-gh Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Sep 4, 2026
@SaadIMC
SaadIMC force-pushed the fix/datalake-catalog-hdfs-storage-type branch from 653fc80 to f0002dd Compare October 29, 2026 18:39
Comment thread src/Databases/DataLake/ICatalog.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 8332f7746 with master 85f48a47c (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

10 object files changed (+25.12 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Databases/DataLake/DatabaseDataLake.cpp.o 1.74 MiB 1.76 MiB +22.64 KiB (+1.27%)

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

109 translation units recompiled, 823 s compile time in total, 109 of them have a recent master baseline.

Job report

@SaadIMC
SaadIMC force-pushed the fix/datalake-catalog-hdfs-storage-type branch from eb49004 to 979ea11 Compare October 30, 2026 17:35
@PedroTadim PedroTadim self-assigned this Nov 2, 2026
@PedroTadim

Copy link
Copy Markdown
Member

🕵️ @SaadIMC

With the database setting allow_experimental_iceberg_compaction = 1, an HDFS table still takes the stateful path in tryGetTableImpl (want_stateful, DatabaseDataLake.cpp:1199): it is cached, and result_storage->startup() starts its background jobs. Its HDFSObjectStorage is now read-only, so every compaction write throws READONLY, and the background task keeps retrying and logging the error for as long as the table stays cached.

Could you leave HDFS out of the stateful path, for example with && storage_type != DatabaseDataLakeStorageType::HDFS in want_stateful? A test arm with the setting on that checks the table still reads and system.errors shows no READONLY after a few seconds would cover it.

@maxknv maxknv added the external Author is not a member of the ClickHouse organization label Nov 2, 2026
@SaadIMC

SaadIMC commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the review @PedroTadim

want_stateful now excludes HDFS (&& storage_type != DatabaseDataLakeStorageType::HDFS), so these tables are never cached as stateful and never start background compaction. I also added a test that creates the catalog database with allow_experimental_iceberg_compaction = 1 and checks that the table still reads and that the READONLY count in system.errors doesn't grow

SaadIMC and others added 4 commits November 2, 2026 09:51
A catalog vends no storage credentials for an `hdfs://` table location, and HDFS
authenticates through the server's `hdfs` configuration instead. With the default
`vended_credentials = 1` and a single database engine argument, resolving such a
table still threw BAD_ARGUMENTS. Skip that check for HDFS, and add an integration
test that resolves an HDFS-located table through a REST catalog.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`SHOW CREATE TABLE` reports a catalog table's engine as `Iceberg`, and `DESCRIBE`
loads the table's metadata file from storage. Start HDFS, write the metadata the
catalog advertises to its location, and read the (empty) table through the catalog.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SaadIMC and others added 8 commits November 2, 2026 09:51
HDFS is read with the server's own identity, so a catalog table on HDFS must
need the same source grant as reading it through `icebergHDFS`. Check it,
filtered on the table location, before building or returning a cached storage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bles

The read grant checked at table resolution is not enough for INSERT, ALTER,
mutations, OPTIMIZE, EXECUTE or a data-deleting DROP, which also write with the
server's HDFS identity. Check WRITE ON HDFS, filtered on the table location, at
each of these entry points and in checkInsertIsAllowed, which also covers the
initiator of an asynchronous insert.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both the read check in DatabaseDataLake and the write check in
StorageObjectStorage now call checkCatalogHDFSAccess, which owns the grant rule
and the location normalization.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Writes reach HDFS through many entrypoints (INSERT and its cluster variant,
ALTER, mutations, OPTIMIZE ... MANIFEST, DROP), and checking WRITE ON HDFS at
each of them kept missing some. Instead, give HDFSObjectStorage a read_only
setting that rejects writes and removals, and turn it on for HDFS tables of a
data lake catalog. The READ ON HDFS check at table resolution stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test runner cannot resolve the namenode hostname; connect the same way
the hdfs_api helpers do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With allow_experimental_iceberg_compaction a catalog table becomes stateful and
runs background compaction, which cannot write to the read-only HDFS storage
and would keep failing with READONLY.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
icebergHDFS checks READ ON HDFS against the HDFS authority, which is what
StorageHDFSConfiguration keeps as its raw URI. Check the catalog table against
that same value, so a grant filtered on the authority allows both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SaadIMC
SaadIMC force-pushed the fix/datalake-catalog-hdfs-storage-type branch from 7e71029 to efecd83 Compare November 2, 2026 15:52
@PedroTadim

Copy link
Copy Markdown
Member

🕵️ @SaadIMC

The access check and the read-only storage look right to me: the check runs before anything is read from HDFS and matches what icebergHDFS checks, and every write or removal in HDFSObjectStorage goes through the guarded writeObject/removeObject. A few small things:

  1. The description and changelog no longer match the code: the grant filter matches the HDFS authority (READ ON HDFS('hdfs://hdfs1:9000')), not the table location, and inserts fail with READONLY, not ACCESS_DENIED. Could you update both?
    2, The READONLY message could say why, e.g. "Tables of a DataLakeCatalog database located on HDFS are read-only".
    3.checkHDFSReadAccess repeats ITableFunction::getFunctionURINormalized; a shared helper would keep them from drifting apart.
  2. The gtest duplicates what the integration test covers; it could be dropped.

Reuse ITableFunction's grant-filter URI normalization instead of a copy, say in
the READONLY error why the table is read-only, and drop the storage-type gtest
that the integration test already covers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SaadIMC

SaadIMC commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the comment! The description and changelog are updated now, and the READONLY message now explains: “tables of a DataLakeCatalog database located on HDFS are read-only”. Also dropped the gtest.

@PedroTadim

Copy link
Copy Markdown
Member

Thanks @SaadIMC! One more CI run after master merge

@PedroTadim
PedroTadim added this pull request to the merge queue Nov 4, 2026
Merged via the queue into ClickHouse:master with commit e1c9e26 Nov 4, 2026
185 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 Nov 4, 2026
@SaadIMC
SaadIMC deleted the fix/datalake-catalog-hdfs-storage-type branch November 11, 2026 20:57
@clickhouse-gh clickhouse-gh Bot added comp-datalake-catalogs Data lake catalogs: the DataLakeCatalog database engine and its catalog clients - Iceberg REST, A... and removed comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 22, 2026
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 comp-datalake-catalogs Data lake catalogs: the DataLakeCatalog database engine and its catalog clients - Iceberg REST, A... external Author is not a member of the ClickHouse organization pr-bugfix Pull request with bugfix, not backported by default 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.

DataLakeCatalog can't read tables stored on HDFS: Unsupported storage type: hdfs://

7 participants