Repository navigation
Do not list the directories of an Azure account with a hierarchical namespace as files - #125500
Conversation
…amespace as files On an account with a hierarchical namespace (ADLS Gen2), List Blobs returns each directory under the prefix as a zero-length blob with metadata hdi_isfolder=true. AzureObjectStorage::listObjects and AzureIteratorAsync never requested metadata and emitted every item, so every caller saw directories as objects. ALTER TABLE ... EXECUTE remove_orphan_files then took <table>/data, <table>/metadata and partition directories for orphan files, called Delete on them and counted a 409 failure for every non-empty one on every run (ClickHouse#125462). Both listings now request blob metadata and skip empty blobs that carry hdi_isfolder=true, the marker DataLakePathClient::GetProperties uses to set IsDirectory (key matched case-insensitively, value compared exactly, as the SDK does). A blob with content is never skipped, and a real empty file has no such metadata, so it is still listed. This makes an HNS listing look like the flat listing every caller is built for, as the Local and HDFS listings already do; the fix is in the listing rather than in the Iceberg command so that the glob iterator, AzureQueue and the plain metadata storages get it too. Azurite has no hierarchical namespace, so the tests create the directory entries by hand with the same marker. Measured on Azurite, a 1000-blob page is byte-identical with and without include=metadata, and the request count does not change. Closes ClickHouse#125462 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…test Add a non-empty blob that carries hdi_isfolder=true to test_glob_skips_directory_entries and expect it in the listing. Only an empty blob with the marker is a directory entry, so a blob with content must still be listed whatever its metadata. Without the BlobSize check the test now fails with marked.csv missing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 2 rounds, 3 findings, 0 in round 2) plus my own review (nits only).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261012-203000 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261012-193200 |
|
Workflow [PR], commit [8454357] Summary: ✅
AI ReviewSummaryReviewed #125500 at Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested. |
CI finish ledger - f96308fEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261013-070008 |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units9 translation units recompiled, 21 s compile time in total, 9 of them have a recent master baseline. |
Closes: #125462
Related: #125329
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Azure Blob Storage listings now skip the directory entries of an account with a hierarchical namespace (ADLS Gen2), so
ALTER TABLE ... EXECUTE remove_orphan_fileson Iceberg tables there only deletes files and no longer reports a failed deletion for every directory. Closes #125462.Description
On an account with a hierarchical namespace,
List Blobsreturns each directory under the prefix as an empty blob withhdi_isfolder=truemetadata.AzureObjectStorage::listObjectsanditeratepassed those entries through as objects, soremove_orphan_filestook<table>/data,<table>/metadataand partition directories for orphan files, tried to delete them, and reported a409failure for each non-empty one on every run. Globs listed them too.Both listings now request blob metadata and skip entries that are empty and carry
hdi_isfolder=true, the marker the Azure SDK'sDataLakePathClient::GetPropertiesuses to setIsDirectory. A blob with content is never skipped, and a real empty file has no such metadata, so it is still listed and still deleted as an orphan. Iceberg code is unchanged.Improvement, notBug Fix: the reported misbehavior is in the experimentalremove_orphan_files, and I could not observe one through a documented surface on a real account with a hierarchical namespace.Validation: Azurite has no hierarchical namespace, so the two new tests create the directory entries by hand with the same marker. Both fail on master (the dry run counts 4 data files instead of 2, and the server log lists
<table>/dataand<table>/metadataas orphans; the glob returnscont/<prefix>/sub) and pass with the fix.test_remove_orphan_files.py,test_storage_azure_blob_storage/test.pyandtest_azure_blob_storage_listobjects_prefixpass. A full listing makes the sameList Blobsrequests, and on Azurite a 1000-blob page is byte-identical with and without metadata, since ClickHouse writes none. With a hierarchical namespace, an existence check (max_keys = 1) now pages past the directory entries that sort before the first file.@zlareb1, I had no real account with a hierarchical namespace; could you confirm it on yours?
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125500]
Version info
26.11.1.2169-master(included in26.11and later)