Repository navigation
Conversation
… object `collectExpiredFiles` decided whether a file of an expired snapshot (manifest list, manifest, data or delete file) is still used by a retained snapshot by comparing the raw path text from the metadata, and deduplicated expired files the same way, while `deleteExpiredFiles` deletes `resolve(path)`. Two spellings of one object (`file://` prefix, `s3a://` vs `s3://`, `./` or `//` on a local or HDFS table, `s3a://` vs `s3://` for a file in another bucket) were therefore different files for the check and the same object for the delete: the expired spelling was scheduled and its delete removed the object the retained snapshot reads, so later reads failed with FILE_DOESNT_EXIST. Add `IcebergPathResolver::storageIdentity`: the `resolve()` result, lexically normalized (and without a trailing `/`) on local and HDFS storage, where the filesystem names those spellings as one path; on object storage `<namespace>/<key>`, where on S3 a fully qualified path is split with `trySplitFullyQualifiedObjectPath` as `S3ObjectStorage::splitBucketAndKey` does, so the scheme of a foreign-bucket URI does not matter. `collectExpiredFiles` builds one set of identities over all retained files (outside any try: a retained path that cannot be resolved fails the command before anything is deleted) and one set of collected identities. An expired data or delete file that cannot be resolved is still scheduled once per raw path, so its delete fails and is counted, as before. Manifest lists and manifests are checked before their read and marked collected only after a successful read, as before, so a failed read is retried by a later occurrence; data and delete files are marked eagerly, as before. The order of deletions and `deleteExpiredFiles` are unchanged. `remove_orphan_files` is not changed: it compares resolved paths, which covers `file://` and same-bucket `s3a://`, not `//` or `./`. Closes ClickHouse#131764 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove the doc line above the collect lambda; its call sites state what it returns. 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; 5 findings over three rounds) plus my own review.
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261115-105100 |
|
Workflow [PR], commit [55b1855] Summary: ❌
AI ReviewSummaryThe PR protects retained Iceberg snapshot files by comparing resolved storage identities instead of raw metadata paths. The current diff and surrounding collection, traversal, commit, and deletion paths support the documented textual aliases. No actionable findings remain within that scope. I accept the deliberate exclusion of relative paths, symlink-dependent paths, and directory pruning through Missing context / blind spots
Final VerdictStatus: ✅ Approve |
expire_snapshots: keep a file that a retained snapshot spells differentlyexpire_snapshots: do not delete a file a retained snapshot still uses
expire_snapshots: do not delete a file a retained snapshot still usesexpire_snapshots: match variants of a storage path as one file
…the storage opens `LocalObjectStorage` takes a relative path from the working directory or from its key prefix (`/` in `clickhouse-local`, `user_files_path` on a server), so `storageIdentity` kept such a spelling of a retained file distinct from its absolute spelling: an expired snapshot that named the current manifest list by `os.path.relpath` (from the working directory, or from `user_files_path` on a server) deleted it. For a relative path on local storage, take the identity from `resolvePathRelativelyToBase` with the storage's `getCommonKeyPrefix`, made absolute, before `lexically_normal`; absolute paths are unchanged. An expired path outside that base (`PATH_ACCESS_DENIED`) is scheduled by its raw path like an unresolvable one, so its delete fails and is counted, as before; so is one whose resolution fails with a `std::filesystem::filesystem_error` (e.g. a directory without search permission), which the delete hits the same way. Strip trailing slashes with `trimTrailingSlashes`. 05770 gets the relative-path case and runs from its work directory, so the respelled path is relative for real; the gtest gets the key-prefix case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…its target `LocalObjectStorage` follows symlinks, so with `metadata_alias -> metadata` a retained snapshot naming `<table>/metadata_alias/snap.avro` and an expired one naming `<table>/metadata/snap.avro` refer to one file. The lexical identity kept them apart, so `expire_snapshots` deleted the manifest list the current snapshot still reads (in either direction of the respelling). A local path is now identified by `weakly_canonical`, which also resolves a symlinked file and keeps the lexical result for parts that do not exist. `weakly_canonical` touches the filesystem, and every expired manifest list repeats the manifests of the lists before it, so identities are now computed once per spelling. On a table with 200 snapshots (199 expired lists, ~19.9k manifest entries) debug-build query time was 0.343 s on the previous head and 0.470 s without the memo, 0.336 s with it. The resolver test gains HDFS rows: an HDFS path keeps the lexical normalization and never goes through the local filesystem. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…torage opens `LocalObjectStorage` passes every key through `resolvePathRelativelyToBase`, which returns the lexically normalized path when the raw one leaves `user_files_path` once its symlinks are followed, e.g. `<table>/alias/../metadata/x.avro` with `alias -> user_files`. `storageIdentity` applied it to relative paths only and canonicalized an absolute raw path instead, so that spelling got an identity outside the table while the storage reads and unlinks the file inside it. An expired snapshot naming the shared manifest list through either spelling then deleted the list the current snapshot reads (measured on a server, both directions). Resolve every local path through `resolvePathRelativelyToBase` first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing commit See the job log for details. |
master enabled modernize-use-nodiscard; the merge queue's clang-tidy check flagged it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the symlink, relative-path and key-prefix handling: no Iceberg writer produces such paths, and following symlinks for the identity made expired deduplication skip a symlink's target. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 55b1855Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Everything else passed in the full re-run after the review threads were resolved, including Session id: cron:clickhouse-premium-slot-30:20261116-103600 |
e508102
Conflicts with master's `IcebergPathResolver::storageIdentity` (ClickHouse#131782) and the per-data-file lookup of position delete files (4f04026): - `storageIdentity` keeps master's signature (throws) and normalization; the optional variant this PR needs becomes `tryStorageIdentity`, both computed from `resolveImpl`, so there is one identity. `storageIdentityOrThrow` is gone. The `is_filesystem` field is replaced by `BlobStorageDescription::isFilesystem()` (`local`/`hdfs`), the test master's identity uses. - `collectExpiredFiles` is master's: it already matches retained and expired files by identity. - `groupPositionDeletesByDataFile` keys the delete files whose bounds name one data file by `tryStorageIdentity` instead of the raw path, so a data file finds its delete files in any spelling; unresolvable bounds go to `other`. The iterator looks them up by the data file's identity (scope `ThisFile`) and checks only `other` with `matchPositionDeleteBounds`; `countDeletedRows` uses the same grouping. New gtest `GroupPositionDeletesByDataFile` fails with raw-path keys. - `getPositionDeleteTransformer` uses master's `usesStreamingPositionDeletes`, then falls back to the bitmap transform for unordered positions as before. - 05568: ClickHouse now writes one position delete file per data file, so the scenarios that need a delete file covering two data files read the Spark table `data_lake_corpus/iceberg/ice143_v2_position_deletes` (no `file_path` bounds) with its rows rewritten the same ways as before. Master returns 40 rows instead of 37 for the respelled rows. - gtest: `EXPECT_THROW((void)resolve(...))` for master's `[[nodiscard]]`; our identity test is renamed `TryStorageIdentity` next to master's `StorageIdentity`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #131764
Related: #131249
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Iceberg
ALTER TABLE ... EXECUTE expire_snapshotsnow treats variants of one storage path (s3a://vss3://, afile://prefix,//or./on a local or HDFS table) as one file, so it no longer deletes a file a retained snapshot still uses.Description
collectExpiredFilescompared raw path text but deleted by the resolved storage path, so two variants of one storage path were two files to the check and one object to the delete. Files are now matched byIcebergPathResolver::storageIdentity: the resolved path, lexically normalized on local and HDFS, and<bucket>/<key>on S3. A retained path that cannot be resolved now fails the query before anything is deleted.Scope: variants that differ only in text. Paths that need the filesystem to compare (symlinks, relative paths,
..through a symlink) are out of scope; no Iceberg writer produces them.remove_orphan_fileshas the same gap for//and./; not changed here.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131782]
Version info
26.11.1.2431-master(included in26.11and later)