You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected FileIO remove_all behavior for S3 #1118
Currently when using the S3 FileIO's remove_all method we noticed the following behavior:
Running remove_all('s3://foo/bar') removes s3://foo/bar* so also siblings such as s3://foo/bar-baz.
I would expect fileio to understand that I provide a folder, and only this folder and subfolders are removed, not siblings that have the same prefix.
ADLS Gen2 behaves differently. Even without a trailing slash siblings are not deleted.
I think we should at least have consistent behavior, I would opt for the one described above.
The question remains what behavior is desired in opendal
@Xuanwo I would slightly tend to only remove "abc" in your example, because its the safe default.
My main point is however that behavior should be consistent across storages.
GCS works like Azure. So out of those three, S3 is the odd one out.
I think if a client calls remove_all(table.location), this should work and be safe. So I would argue we should treat the input always as a directory / append a path.
I think if a client calls remove_all(table.location), this should work and be safe. So I would argue we should treat the input always as a directory / append a path.
I have a suggestion that rename this API to remove_dir_all which indicate that it only removes a dir recursively. And in this API, we make sure that both abc and abc/ works correctly. What do you think?
I think if a client calls remove_all(table.location), this should work and be safe. So I would argue we should treat the input always as a directory / append a path.
I have a suggestion that rename this API to remove_dir_all which indicate that it only removes a dir recursively. And in this API, we make sure that both abc and abc/ works correctly. What do you think?
Activity
c-thiel commentedon Mar 20, 2025
ADLS Gen2 behaves differently. Even without a trailing slash siblings are not deleted.
I think we should at least have consistent behavior, I would opt for the one described above.
The question remains what behavior is desired in opendal
liurenjie1024 commentedon Mar 21, 2025
I guess this is opendal's behavior, and it seems reasonable to append "/" at end if not present. cc @Xuanwo
Xuanwo commentedon Mar 21, 2025
OpenDAL treats input path as a prefix so remove_all("abc") will remove all keys that starts "abc" so it's expected that "abcd" will also be removed.
The ADLS Gen2 behavior is not expected to me, it might be a bug that need to address.
Back to iceberg, if we want to ensure that remove_all is just dir, we can always append a / to the path.
Xuanwo commentedon Mar 24, 2025
Hi, @c-thiel, what’s your expected behavior? I’m happy to help resolve this.
c-thiel commentedon Mar 27, 2025
@Xuanwo I would slightly tend to only remove "abc" in your example, because its the safe default.
My main point is however that behavior should be consistent across storages.
GCS works like Azure. So out of those three, S3 is the odd one out.
c-thiel commentedon Mar 27, 2025
I think if a client calls
remove_all(table.location), this should work and be safe. So I would argue we should treat the input always as a directory / append a path.Xuanwo commentedon Mar 28, 2025
Thank you @c-thiel, I will get this fixed.
And also, I confirmed that the opendal behavior in
ADLS Gen2is wrong. I will take another look.This is a surprise. Have you enabled gcs's Hierarchical Namespace for the bucket?
Xuanwo commentedon Mar 28, 2025
I have a suggestion that rename this API to
remove_dir_allwhich indicate that it only removes a dir recursively. And in this API, we make sure that bothabcandabc/works correctly. What do you think?This also aligns with std's
remove_dir_all.Or are you expecting us to first check if
abc/exists and then decide whether to remove a prefix or a directory?I'm fine with both approaches at the iceberg FileIO side.
liurenjie1024 commentedon Mar 31, 2025
+1 for following std's naming convention to have different methods for
remove_dir_allandremove_dir(for empty dir)Xuanwo commentedon Apr 7, 2025
Nice, let me handle this.
liurenjie1024 commentedon Apr 21, 2025
cc @Xuanwo Are we going to fix this ? It's the last issue in 0.5.0 release
Xuanwo commentedon Apr 21, 2025
Yep, let me do this in this week.
liurenjie1024 commentedon Apr 29, 2025
cc @Xuanwo Do you have time to work on this? I can handle it if you are busy.
Xuanwo commentedon Apr 29, 2025
Will finish this today 😚
refactor: Add FileIO::remove_dir_all to deprecate remove_dir (apache#…