Repository navigation
fix(io): delete only the named directory in FileIO::delete_dir - #1135
Merged
JingsongLi merged 1 commit intoOct 16, 2026
Merged
Conversation
`delete_dir` passed the directory path to OpenDAL without a trailing slash, unlike `exists_dir`, `mkdirs` and `list_status`. OpenDAL's path trim then stripped a trailing space from the name, and a backend without native recursive delete, such as S3 or OSS, removed every key with that prefix. Dropping table `orders` also deleted `orders_bak` and `orders2024`, and renaming branch `b1` on a backend without native rename also deleted `b10`. Deleting the `<table>/month=1` path that format-table DROP PARTITION passes also took `month=10` to `month=12`. On a local filesystem, dropping table `t1 ` deleted `t1`, and dropping format-table partition `dt=a ` deleted the directory of `dt=a`. Normalize the path with `normalize_root`, as the other directory operations do.
JingsongLi
approved these changes
Oct 16, 2026
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.
On a FileSystemCatalog over S3 or OSS,
DROP TABLE ordersalso deletesorders_bakandorders2024, andsys.rename_branchfromb1also deletesb10. On these stores, format-table DROP PARTITIONmonth=1also removesmonth=10tomonth=12, which stay registered.FileIO::delete_dirpasses the path without a trailing/. OpenDAL then trims a trailing space off the name (droppingt1deletest1), and its emulated recursive delete matches every key with that prefix. Java'sFileSystemCatalogdeletes only that directory.Fix: build the path with
normalize_root, asexists_dir,mkdirsandlist_statusdo. This covers every caller, includingdrop_branch(#941). The new tests fail on main; the memory backend deletes by prefix as S3 and OSS do.FileIO::renametrims the same way, but OpenDAL rejects a rename path ending in/, so that needs a separate change.