Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove statuses from ls_with_sizes and do not mask failures on POSIX. #5043

Merged
merged 10 commits into from
Jun 6, 2024

Conversation

teo-tsirpanis
Copy link
Member

@teo-tsirpanis teo-tsirpanis commented Jun 4, 2024

SC-23179
SC-48851
SC-48854

This PR updates the signature of ls_with_sizes in the VFS class and the specific VFS implementations1 to indicate errors by throwing exceptions instead of returning Status.

On top of that, Posix::ls_with_sizes was updated to fail if opendir failed with an error code other than ENOENT (see also #5037 (comment)).

Also in Posix::ls_with_sizes, the pointer returned by opendir was updated to be placed inside a smart pointer, making sure it gets freed. This caused errors in the find_head_api_violations.py script, which were fixed.


TYPE: BUG
DESC: Do not mask failures when listing a directory fails on POSIX.

Footnotes

  1. HDFS was not updated to minimize risk.

@teo-tsirpanis teo-tsirpanis changed the title Remove status from ls_with_sizes and do not mask failures on POSIX. Remove statuses from ls_with_sizes and do not mask failures on POSIX. Jun 4, 2024
test/support/src/vfs_helpers.cc Show resolved Hide resolved
@@ -58,6 +58,18 @@ using filesystem::directory_entry;

namespace tiledb::sm {

struct UniqueDIRDeleter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just wrap DIR in a class here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but the implementation would be quite more complex. By extending unique_ptr we take advantage of its RAII capabilities, while reducing complexity and code changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are using a deleter to implement a close method. It's confusing. The class to do this will not be complex at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen this pattern in other projects, and we are doing similar stuff in the C++ API but sure, I changed it to a dedicated class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you talking about the one in curl?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and also in the zstd compressor. Turns out I was wrong about the C++ API, we are using shared_ptr instead of unique_ptr there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curl code is 5 years old... The ZSTD context one is a free function, which makes more sense as a deleter.

@KiterLuc KiterLuc merged commit 2dc4fb7 into dev Jun 6, 2024
60 checks passed
@KiterLuc KiterLuc deleted the teo/ls-optional-fix branch June 6, 2024 07:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants