fix(retention): preserve scheme/authority when deriving backup manifest paths#1
Closed
jiang95-dev wants to merge 1 commit into
Closed
fix(retention): preserve scheme/authority when deriving backup manifest paths#1jiang95-dev wants to merge 1 commit into
jiang95-dev wants to merge 1 commit into
Conversation
…st paths Retention backup-manifest writing used java.nio.file.Paths to derive the parent directory of a data file. Paths is not URI-aware: it collapses hdfs://authority/... into hdfs:/authority/..., dropping the authority. The mangled path then resolved against the default filesystem root and failed with "Permission denied ... inode=/". This bit tables whose newer data files are stored as fully-qualified hdfs:// URIs while older ones are bare paths. Use Hadoop Path (which preserves scheme + authority) via a testable dataFileParent() helper, and add OperationsBackupPathTest covering both the qualified and bare path forms. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
Superseded by linkedin#633 (opened against upstream). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Retention with backup enabled failed with
Permission denied ... access=WRITE, inode="/"when writingdata_manifest.json. The root cause is that backup-manifest path derivation usedjava.nio.file.Paths, which is not URI-aware and collapseshdfs://authority/...intohdfs:/authority/..., dropping the authority. The mangled path then resolved against the default filesystem root and tried tomkdirsa bogus top-level directory. This affected tables whose newer data files are stored as fully-qualifiedhdfs://URIs while older partitions use bare paths (a mix Iceberg persists verbatim in manifests). The fix derives the parent directory with HadoopPath, which preserves scheme + authority.Changes
Bug Fixes
Operations.prepareBackupDataManifestsnow derives a data file's parent via a newdataFileParent()helper backed by HadoopPathinstead ofjava.nio.file.Paths, preserving scheme + authority for fully-qualifiedhdfs://paths.getTrashPath(String, String, String)is now astatic@VisibleForTestingpure function so the path math is directly unit-testable.Tests
OperationsBackupPathTest, a pure-Java (no Spark) regression test covering both fully-qualifiedhdfs://authority/...and bare/data/...data file forms, asserting the authority is preserved and the backup dir is inserted correctly.Testing Done
OperationsBackupPathTest(4 cases) passes on the fix. RevertingdataFileParentto the oldjava.nio.file.Pathsimplementation makes the two authority-bearing cases fail (hdfs://ltx1-holdem/...→hdfs:/ltx1-holdem/...), confirming the tests catch the regression; the bare-path cases continue to pass. ExistingtestRetentionDataManifestWith*andtestRetentionWithBackupFails*integration tests (which exercisebackupEnabled=true) pass on both the Spark 3.1 and 3.5 modules.