Repository navigation
Restore HDFS integration tests (it's trash, but there is a tiny chance we can handle it) - #113396
Conversation
Bring back the HDFS integration tests that were removed in #74295 ("CI: Remove hdfs from Integration tests", January 2025) while the HDFS support itself (the hdfs/hdfsCluster table functions, the HDFS table engine, the hdfs disk type and DatabaseHDFS) stayed in the tree. Restored: - tests/integration/compose/docker_compose_hdfs.yml - helpers/hdfs_api.py - without the Kerberos machinery, because the support for Kerberized HDFS was removed from ClickHouse in #66765 - with_hdfs support in helpers/cluster.py - test_storage_hdfs, test_merge_tree_hdfs, test_log_family_hdfs, test_redirect_url_storage - the HDFS cases of test_allowed_url_from_config and the "system drop schema cache for hdfs" cross-checks in test_storage_azure_blob_storage - PyHDFS in the integration tests runner image requirements Adapted to the current master where the expectations drifted since January 2025: - every part now writes columns_substreams.txt, so the per-part file counts in test_merge_tree_hdfs gained FILES_OVERHEAD_COLUMNS_SUBSTREAMS - auto_statistics_types defaults to "minmax, uniq" now and would add statistics files to parts, so the test tables disable it, matching test_merge_tree_s3 - detached parts now keep their metadata_version.txt, so DETACH PARTITION no longer reduces the object count - object count assertions poll until convergence instead of asserting immediately, matching the current test_log_family_s3 - ruff fixes (f-string and unused-variable cleanups) The tests are skipped on ARM, as before, because the prasanthj/docker-hadoop image is published for amd64 only. Not restored: the Kerberized HDFS tests (the feature is gone), the HDFS bits of test_disk_types, test_endpoint_macro_substitution and test_keeper_disks (these suites were since restructured to keep a single config for the public and private repos), and the icebergHDFS cases of the Iceberg suites (restructured into many modules; can be restored separately). Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Workflow [PR], commit [d557abd] Summary: ✅
AI ReviewSummaryThis PR restores the HDFS integration coverage and fixes the missing-parent-directory write failure for the Findings❌ Blockers
Final VerdictChanges requested. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 51/62 (82.26%) · Uncovered code |
PyHDFS==0.4.0 is already there (the earlier grep for it was case-sensitive), and pip refuses to install two pinned versions: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=8c67b7dac9abc89d082d2e690033685c6cc60b93&name_0=PR&name_1=Dockers%20Build%20%28arm%29 Co-Authored-By: Claude Fable 5 <[email protected]>
All 22 failures in `Integration tests (amd_asan_ubsan, flaky)` reduce to three causes: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=1c45aad21479ffccd7c9e5099a0aab2667981054&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 1. pyhdfs 0.4.0 (the runner image has it now; the tests were written against 0.3.1) no longer defaults `user_name` to the local user, so WebHDFS requests ran as `nobody` and every write to `/` failed with `HdfsAccessControlException`. Pass `user_name="root"` at every `HdfsClient` construction site. 2. `PartitionManager._add_rule` was renamed to `add_rule` while the tests were gone; `test_url_reconnect` used the old name. 3. Since #73518 an enum glob (single brackets expansion, e.g. `{1..5}` or `{1,2,3,4,5}`) expands into concrete paths without listing, and every expanded path must exist. Reference only the files the test actually creates, matching the `test_s3_enum_glob_should_not_list` adaptation in the same PR. Co-Authored-By: Claude Fable 5 <[email protected]>
Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=e3bf4f2e31f4584644ae751c54049cc1253c4070&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 The interesting one is a product regression that went unnoticed while the HDFS tests were gone: object storage disks generate keys with a nested prefix (`[a-z]{3}/[a-z]{29}`), but unlike blob storages HDFS has real directories and `hdfsOpenFile` does not create the missing parent, so every write on an `hdfs` disk failed with "Unable to open HDFS file ... Parent directory doesn't exist". Create the parent directory in `HDFSObjectStorage::writeObject`, like `LocalObjectStorage` does for the same reason. Test adaptations: - the object count assertions in `test_merge_tree_hdfs` and `test_log_family_hdfs` now list files recursively, because the keys contain the nested directory prefix - `test_log_family_hdfs` drops the table in a `finally` block, so one failed parametrization no longer cascades into `TABLE_ALREADY_EXISTS` in the rest (matching `test_log_family_s3`) - `PartitionManager` rules now require an `instance` key (`test_url_reconnect`) - `use_hive_partitioning` is on by default now and the directory name `itime=...` in `test_write_files_with_spaces` looks like a hive partition, which added a partition column to `SELECT *` - schema inference of the `JSON` format now infers `Int64` for integer values where it previously fell back to `String` (`test_format_detection`) Co-Authored-By: Claude Fable 5 <[email protected]>
The previous commit accidentally reverted HDFSObjectStorage.cpp to a pre-merge state, dropping makeObjectMetadata and breaking the unit_tests_dbms link: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=bf322240f4e4f6c186732010074393ead967629a&name_0=PR&name_1=Build%20%28amd_debug%29 Re-apply the parent-directory creation on top of the current master version of the file, with no other changes. Co-Authored-By: Claude Fable 5 <[email protected]>
…titionManager Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=3437181a608b4f7bd7aba42da221bd175ffb5f5c&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 - Wide parts now write `serialization.json` and a `.size` substream pair for String columns, which put 19 files into a part instead of the 17 the FILES_OVERHEAD_* constants expect. Pin `serialization_info_version` to `basic` and `min_bytes_for_full_part_storage` to 0 in the test config, exactly like `test_merge_tree_s3` does (verified locally: wide part = 17 files, compact part = 13 files). - `PartitionManager` executes iptables inside the container now, so the old host-side rule (match by source port on the way to the node) has no equivalent chain, and `--sport` without `-p tcp` is rejected by iptables anyway. Block the outgoing connections to the datanode web port with a silent DROP in the OUTPUT chain instead: the client then observes "Timeout: connect timed out" (which the test asserts) and retries. Also `_delete_rule` was renamed to `delete_rule`. Co-Authored-By: Claude Fable 5 <[email protected]>
Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=94a3032a6add32ebbe5d21188606ad0bc9ce35fd&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 - Since #111816 a small skip index goes into a single `skp_idx.packed` archive instead of an `.idx2` + `.cmrk2` pair, so a part holds one file less. Mirror the `FILES_SAVED_BY_PACKED_SKIP_INDEX` adjustment from `test_merge_tree_s3` (verified against the current master binary on a `local_blob_storage` disk: wide part = 16 objects, compact = 12, plus `format_version.txt`). - In `test_url_reconnect`, heal the network only after the client demonstrably hit a connect timeout instead of after a fixed 4-second sleep. On a loaded runner the query reached its first connect attempt after the rule was already deleted, so nothing timed out and the expected log line never appeared. The log poll also subsumes the previous `contains_in_log` assertion. Co-Authored-By: Claude Fable 5 <[email protected]>
Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=b03367669db91fef6364f475e854322b686ad703&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 Another product regression surfaced by the restored tests: every operation that produces an empty part (DETACH PARTITION, DROP PARTITION, TRUNCATE, REPLACE PARTITION) permanently leaked seven zero-byte objects on an hdfs disk. The empty part writer opens streams for every column and skip index, writes zero rows, and WriteBufferWithFinalizeCallback then cancels the underlying buffer, expecting the cancel to leave no blob behind ("This will call cancelImpl of the underlying buffer"). That holds for blob storages, which create the object only at finalize, but HDFS creates the file already at open, and WriteBufferFromHDFS had no cancelImpl - so the files stayed forever, unreferenced by any metadata. Implement WriteBufferFromHDFS::cancelImpl to remove the file created by the constructor. Appends are left untouched: removing the file there would lose the previous content. In the test, the leak showed up as exactly +7 objects after every DETACH and as 7 undeletable objects in the teardown of the neighboring tests. Also mirror the current `CHECK TABLE` form from test_merge_tree_s3 (per-part results are returned without check_query_single_value_result=1 now). Co-Authored-By: Claude Fable 5 <[email protected]>
Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=c4c8fd505f0177fc6dd1760fd46537b4cd48d295&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 Mirror FILES_OVERHEAD_PER_INVALIDATED_COLUMN from test_merge_tree_s3: ATTACH PARTITION and the partitions moved or replaced between tables carry one extra object each. Verified against the current master binary on a local_blob_storage disk - the after-move (66), after-insert (98) and after-replace (68) counts match the adjusted formulas exactly. The post-ATTACH assertion also polls now instead of asserting immediately, because the outdated metadata removal is asynchronous. Co-Authored-By: Claude Fable 5 <[email protected]>
- `HDFSApi` now passes its `timeout` to every request, so a nonresponsive NameNode/DataNode fails the test quickly instead of hanging the shard. - `test_bad_hdfs_uri` asserts explicitly: the malformed URL is rejected at CREATE, the unreachable NameNode and the nonexistent path fail on the first SELECT. Previously nothing required the queries to fail at all. - `test_url_with_redirect_not_allowed` uses `query_and_get_error` instead of `pytest.raises` around an `assert`, which also accepted a wrong successful result. - `test_schema_inference` in `test_allowed_url_from_config` queries a well-formed disallowed URL and asserts the host-check error, instead of a string literal with a stray backtick. - `test_cluster_join` and `test_cluster_macro` create their own files and assert concrete non-empty results; they used to read a directory that `test_hdfsCluster` had already deleted, passing on empty input. - The `SYSTEM DROP SCHEMA CACHE FOR HDFS` cross-checks in the Azure suite now assert that the Azure entries survive the HDFS-scoped drop (`system.schema_inference_cache`), not just that a re-inference works. - Fixed the `UINt64` typo in `test_skip_empty_files`, which made that branch pass on the unknown-type error rather than on the empty-file behavior. Co-Authored-By: Claude Fable 5 <[email protected]>
…ition_by`
The cleanup deleted the literal path `/{dir}` instead of the generated
`partition_<uuid>` directory, leaking partitioned files into the shared
HDFS namespace for the rest of the module. Delete the actual directory
from a `finally` block so the cleanup also runs after a failed assertion.
Co-Authored-By: Claude Fable 5 <[email protected]>
Address review: creating real parent directories for the generated object
keys (`<prefix>/[a-z]{3}/[a-z]{29}`) in `writeObject` fixed writes, but
`removeObject` still deleted only the file, so every blob lifecycle left
one empty directory behind, growing the NameNode namespace without bound.
Mirror `LocalObjectStorage::removeObject`: after a successful
`hdfsDelete`, walk up the parent directories and delete the emptied ones
up to the data directory. A non-recursive `hdfsDelete` fails on a
non-empty directory, so the walk stops at the first directory that still
holds other blobs; the cleanup is best-effort by design.
Add a focused integration test `test_no_leftover_directories_after_removal`
verifying that object removal deletes the empty prefix directories as well
as the files.
Co-Authored-By: Claude Fable 5 <[email protected]>
Address review: `writeObject` creates the parent directories for the generated object keys, and `removeObject` cleans them up on removal, but a canceled write (e.g. a zero-row rewrite of a part) never reaches `removeObject` - `WriteBufferFromHDFS::cancelImpl` deleted only the file itself, so every canceled write leaked one empty prefix directory and grew the NameNode namespace without bound. Extract the best-effort walk that deletes emptied parent directories up to the data directory into `removeEmptiedParentDirectories` in `HDFSCommon`, call it from both `HDFSObjectStorage::removeObject` and the cancel path of `WriteBufferFromHDFS` (which now receives the cleanup root from `writeObject`), and add an integration test that cancels an `INSERT` mid-stream and checks that no files or directories are left behind. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 @groeneai, investigate these two stress-test failures and provide fixes in separate PRs (if fixes are already in progress, link them here). Both are pre-existing master-wide flakes unrelated to this PR — CIDB shows them across many PRs and on master (
The other two reds on the previous run are already handled: |
|
Both are unrelated to this PR and both are already owned. Item 1 is mine and its fix is in review; item 2 is the #107619 family, where three of the four in-flight fixes are yours. 1.
|
| PR | author | draft | mergeable | what it changes |
|---|---|---|---|---|
| #102308 | yours | yes | CONFLICTING | PreparedSets.cpp / .h / Planner.cpp; rewrites both in-place build paths |
| #102192 | yours | yes | MERGEABLE | 45 files, 24 new clone() implementations, 0 PreparedSets files |
| #112968 | yours | no | MERGEABLE | buildSetsForDAG returns readiness; object-storage _path / _file filter |
| #109722 | mine | no | MERGEABLE | not a fix for this family, see below |
#109722 should not be counted here: its only PreparedSets.cpp hunk is 5 added and 10 deleted lines, all of them comments, and its functional change is carrying resource handles through QueryPlan::clone. I flagged that on #110073 (comment 5224251014) after it was listed there as a related in-progress fix.
Why the family survives merged #107924: on master today FutureSetFromSubquery::build still does auto plan = std::move(source); (src/Interpreters/PreparedSets.cpp:379), the unordered buildSetInplace (:394) calls it unguarded, and clone-and-retry exists only in buildOrderedSetInplace (:429, clone at :503). #107924 made only the ordered build non-destructive. So of the four, #102308 is the only one that covers this row's mechanism, and it is also the only conflicting one; #112968 is the only non-draft, so it is the likeliest to land first, and it does not touch the unordered build.
One thing worth asserting against whichever lands first: this row's set is consumed at execution time by FilterTransform (FunctionIn::executeImpl, src/Functions/in.cpp:116), not by a CreatingSets step or a MergeTree reader. A fix confined to the in-place build paths does not obviously make the set ready for that consumer.
I am not opening a competing fix, since three of the four are yours. If you would rather I took the unordered buildSetInplace path separately from #102308, say so and I will.
No breadth count from me this time: the play quota is exhausted until 06:13Z (read_rows = 300021802517/300000000000), so I could only quote yesterday's figures. Your "across many PRs and on master" matches what I have recorded. If you quote a number later, note that keying on the message text rather than on the STID gives roughly 1.7x the population - that is what made the two master counts on #110073 look inconsistent.
3. The other two reds
Both confirmed independently. ec1a1cdadf2 is on master and is already contained in this PR's head cf1d659e (224 commits ahead of it, 0 behind), and it touches only tests/queries/0_stateless/04561_ie_join_storage_join.sql. The Build profile diff red is the CI-logs-cluster query failure, matching the bot comment on this PR.
…FS checks The HDFS restoration of `test_allowed_url_from_config` overwrote the file section with the pre-removal version and dropped `test_storage_engine_remote`, the only integration test exercising `CREATE TABLE ... ENGINE = Remote/RemoteSecure` under `remote_url_allow_hosts`. Keep it and add the HDFS checks alongside. Co-Authored-By: Claude Fable 5 <[email protected]>
…ps `sizes.json` The test asserted zero objects after a canceled INSERT, but `LogSink` saves the file sizes (`sizes.json`) upfront "to be able to rollback in case of error", so one committed, metadata-tracked object legitimately remains: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=cf1d659ea4cac0e9dbafe81f912272fb161543c8&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 Assert the real invariants instead: a canceled insert rolls back to the pre-insert object count, keeps the table readable, and leaves no empty prefix directories behind. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 Disposition of the CI failures on cf1d659:
|
|
Discharging the promise from my earlier comment: the fix for It is open and in CI. Scope is the element-type choice in |
…l_reconnect` `contains_in_log` greps the whole server log, so an older timeout line from a previous query in this module would satisfy the check immediately and delete the `DROP` rule before the current query has timed out, reintroducing the heal-too-early race. Snapshot `count_in_log` before starting the query and wait for the count to increase.
|
🕵 Disposition of the CI failure on 380c052: Also merged master and addressed the AI review Major (fresh-timeout wait in |
The `HDFS` table engine and the `hdfs` table function construct `HDFSObjectStorage` with the URL stripped down to the NameNode, so `data_directory == "/"`. On that path, `removeObject` and the canceled-write cleanup walked all the way up from a user file and deleted its emptied ancestor directories, although only the `hdfs` disk creates the nested prefix directories this cleanup is for. `removeEmptiedParentDirectories` now does nothing when the root is `/`, and a regression test checks that `TRUNCATE` of an `HDFS` table keeps the user-managed directories. Co-Authored-By: Claude Fable 5 <[email protected]>
| /// down to the NameNode, so their files live in user-managed directories that must not be | ||
| /// pruned. Only the `hdfs` disk, whose endpoint always carries a nested data directory, | ||
| /// creates the prefix directories this cleanup is for. | ||
| if (root == "/") |
There was a problem hiding this comment.
This root == \"/\" fast-path can’t distinguish ENGINE = HDFS from a disk configured at HDFS root. registerHDFSObjectStorage accepts endpoint = 'hdfs://<nn>:<port>/' (it only enforces the trailing slash), so for that valid hdfs disk config data_directory == "/" and both removeObject and the cancel cleanup now return here without deleting the empty random prefix directories. That reintroduces the NameNode-namespace leak this PR is fixing for every DROP / TRUNCATE / canceled write on root-backed disks.
`HDFSObjectStorage::writeObject` creates the object key's prefix directory
(`hdfsCreateDirectory`) and opens the object (`hdfsOpenFile`) in two separate
NameNode requests, with a `createHDFSFS` connect in between, while
`removeEmptiedParentDirectories` deleted that directory as soon as it became
empty: from `removeObject`, from `WriteBufferFromHDFS::removeFileOnCancel`, and
transitively from `BlobKillerThread::removeBlobsBatch`. Object keys are a
hardcoded `[a-z]{3}/[a-z]{29}`, so two unrelated blobs sharing a prefix
directory is a birthday collision among 17576 buckets rather than an exotic
case. A removal that emptied the directory inside that window made
`hdfsOpenFile` fail `verifyParentDir`, so any write to an `hdfs` disk could
fail with `Code: 76. DB::Exception: Unable to open HDFS file: ... error: Parent
directory doesn't exist`. `REPLACE PARTITION` is where CI saw it, because it is
the one step that writes a new blob per cloned part while the parts it replaced
out are being removed.
The two requests cannot be collapsed into one: libhdfs3's C entry point
hardcodes `createParent = false`
(`contrib/libhdfs3/src/client/Hdfs.cpp:698`), so there is no atomic
create-with-parents to call. And no in-process coordination can help, because
one `hdfs` root is legitimately written and reclaimed by several servers:
`allow_remote_fs_zero_copy_replication` makes multi-server access to a single
root a first-class configuration, and blob removal for such a root runs on any
replica. A bounded retry would only lower the probability, not establish the
invariant. So remove the reclamation and keep the parent-directory creation:
with nothing deleting a prefix directory, a write that has created its parent
can always open its object, in every configuration, with no new state, no lock
and no retry. This also drops one NameNode request per object deletion.
The reclamation was added to keep the NameNode namespace from growing without
bound. For the `hdfs` disk that premise does not hold: keys come from
`createObjectStorageKeyGeneratorByPrefix`, so the retained set saturates at
17576 directories per root and does not grow with data volume, roughly 2.6 MB
of NameNode heap at 150 bytes per inode, and a disk holding many blobs already
has that many live directories. ClickHouse also already retains those
directories forever for `/`-rooted HDFS storages. The one residual cost is that
`listObjects` recurses into retained empty directories, bounded by the same
17576 per root.
Two consequences that are disclosed rather than fixed here. An `hdfs` object
storage with `metadata_type = plain` takes keys from
`MetadataStorageFromPlainObjectStorage` instead, where they are logical paths of
unbounded count and the object storage is the only directory manager, so this
change does leak empty directories there; the `hdfs` disk is itself documented
unsupported (`storing-data.mdx:48`), the combination has no test configuration
anywhere under `tests/`, and I measured it already failing before this change,
at `CREATE TABLE` with `Code: 660. DB::Exception: Cannot get file info for:
.../format_version.txt`, so nothing that works today regresses.
`LocalObjectStorage` has the same create-then-reap shape, but a local root has a
single writing process, so its reclamation can be made safe by coordination; I
have no observed failure of it and left it alone.
`test_no_leftover_directories_after_removal` becomes
`test_prefix_directories_are_not_reclaimed`: it records the set of directories
present and asserts that `TRUNCATE` removes the objects and none of those
directories. `test_no_leftover_directories_after_canceled_write` becomes
`test_no_leftover_files_after_canceled_write`: it keeps every assertion about
files, which is still correct behaviour, and makes the same set comparison
across the canceled insert. Comparing sets rather than counts is what keeps both
specific, since a directory retained by an earlier test in the module cannot
satisfy either assertion. Both fail on a binary that still reclaims, with no
failpoint and no timing: the first is left with an empty directory set, and the
second loses the prefix directory of the `sizes.json` blob that `LogSink`
rewrites upfront on every insert to be able to roll back (`FileChecker::save`
writes a new blob and `replaceFile`s over the old one). The file's one
`time.sleep` poll is gone.
Both of those assertions bite on the `removeObject` site. I measured that the
`removeFileOnCancel` site has no test oracle: a binary with only the
`removeObject` reclamation deleted leaves the whole module green. That site can
only ever reclaim the prefix directory of the file the canceled write itself
created, which is never a member of a set captured before that write, so no
before/after comparison in this test can see it. It is covered by the argument
that a canceled write and a concurrent write can collide on a prefix exactly as
a removal and a write can, not by a test.
Validated with a concurrent write/remove workload on an `hdfs` disk, with the
object-key space temporarily narrowed so the prefix collision is frequent
instead of once per few hundred CI runs: 4 client failures and 10 server-log
occurrences per 640 queries with the reclamation present, 0 with it deleted,
the two arms differing only by that mechanism. Both files were run on both
binaries: `test_log_family_hdfs` is 2 failed / 3 passed before the change and 5
passed after, the two failures being exactly the two adapted tests, and
`test_merge_tree_hdfs` is 7 passed on both, including the
`test_move_replace_partition_to_another_table` that CI reported.
`test_log_family_hdfs --count 20` is 100/100.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118526&sha=051fe4723d3ee9e1f6145a87924182005b690534&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%205%2F6%29
Carrier pull request whose CI produced that report (unrelated to the cause): ClickHouse#118526
Related: ClickHouse#113396
Co-Authored-By: Claude Opus 5 <[email protected]>
The test needs a live HDFS, which the integration test framework cannot start here:
TypeError: ClickHouseCluster.add_instance() got an unexpected keyword argument
'with_hdfs'. Did you mean 'with_nats'?
HDFS was taken out of the integration tests in #74295 ("CI: Remove hdfs from
Integration tests", January 2025) while the HDFS support in the server stayed. It
was only brought back in #113396 ("Restore HDFS integration tests", August 2026),
which is after this branch was cut: `with_hdfs` in `helpers/cluster.py`,
`helpers/hdfs_api.py` and `compose/docker_compose_hdfs.yml` are all absent here.
The 26.8 and 26.9 backports of this change have all three and merged as they were.
The test cannot be adapted: it writes files through `hdfs_api.write_data` and reads
them back over `hdfs://hdfs1:9000`, so there is nothing to assert without a running
namenode. Restoring the framework support instead would add three files of shared
test infrastructure and a third-party Docker Hub image to a release branch for one
test, so the test is dropped here and the `DatabaseHDFS.cpp` fix is kept as-is. The
test still runs on master, 26.8 and 26.9.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The test needs a live HDFS, which the integration test framework cannot start here:
TypeError: ClickHouseCluster.add_instance() got an unexpected keyword argument
'with_hdfs'. Did you mean 'with_nats'?
HDFS was taken out of the integration tests in #74295 ("CI: Remove hdfs from
Integration tests", January 2025) while the HDFS support in the server stayed. It
was only brought back in #113396 ("Restore HDFS integration tests", August 2026),
which is after this branch was cut: `with_hdfs` in `helpers/cluster.py`,
`helpers/hdfs_api.py` and `compose/docker_compose_hdfs.yml` are all absent here.
The 26.8 and 26.9 backports of this change have all three and merged as they were.
The test cannot be adapted: it writes files through `hdfs_api.write_data` and reads
them back over `hdfs://hdfs1:9000`, so there is nothing to assert without a running
namenode. Restoring the framework support instead would add three files of shared
test infrastructure and a third-party Docker Hub image to a release branch for one
test, so the test is dropped here and the `DatabaseHDFS.cpp` fix is kept as-is. The
test still runs on master, 26.8 and 26.9.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed writes to the
hdfsdisk: they failed withParent directory doesn't existbecause the generated object keys contain a nested directory prefix, but unlike blob storages HDFS has real directories and does not create the missing parent on file creation. Also restored the HDFS integration tests that were removed in #74295, which is how this regression went unnoticed.Documentation entry for user-facing changes
Bring back the HDFS integration tests that were removed in #74295, while the HDFS support itself (the
hdfs/hdfsClustertable functions, theHDFStable engine, thehdfsdisk type andDatabaseHDFS) stayed in the tree and has been untested by integration tests since.Related: #74295
Related: #74405
Restoring the tests immediately caught a product regression: object storage disks generate keys with a nested prefix (
[a-z]{3}/[a-z]{29}), buthdfsOpenFiledoes not create the missing parent directory, so every write on anhdfsdisk fails on current master withUnable to open HDFS file ... Parent directory doesn't exist. Fixed by creating the parent directory inHDFSObjectStorage::writeObject, likeLocalObjectStoragedoes for the same reason.Restored:
tests/integration/compose/docker_compose_hdfs.ymlandwith_hdfssupport inhelpers/cluster.py,helpers/hdfs_api.py— without the Kerberos machinery, because the support for Kerberized HDFS was removed from ClickHouse in Cherry pick #65777 to 24.3: Makeallow_experimental_analyzerbe controlled by the initiator for distributed queries #66765,test_storage_hdfs(43 tests),test_merge_tree_hdfs,test_log_family_hdfs,test_redirect_url_storage,test_allowed_url_from_configand theSYSTEM DROP SCHEMA CACHE FOR HDFScross-checks intest_storage_azure_blob_storage.Adaptations to behavior that changed since January 2025:
columns_substreams.txtnow, andauto_statistics_typesdefaults tominmax, uniq— per-part file counts adjusted and auto statistics disabled in test tables, matchingtest_merge_tree_s3,metadata_version.txt,{1..N},{a,b}) expands into concrete paths that must all exist since Optimize glob iterator #73518,user_nameto the local user — passed explicitly,PartitionManagerrules require aninstancekey now,use_hive_partitioningis on by default, and schema inference of theJSONformat infersInt64where it previously fell back toString,The tests are skipped on ARM via
is_arm, as before the removal, because theprasanthj/docker-hadoopimage is published foramd64only (the same situation astest_hive_querywith itshive_testimage).Not restored (out of scope):
test_disk_types,test_endpoint_macro_substitutionandtest_keeper_disks— these suites were since restructured to keep a single config for the public and private repos, and restoring HDFS there would reintroduce per-arch config forks,icebergHDFScases of the Iceberg suites —test_storage_icebergwas restructured into many modules since; can be restored separately.