Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support for recursive delete in EncryptedFileSystem #118

Conversation

TheBeruriahIncident
Copy link

@TheBeruriahIncident TheBeruriahIncident commented Apr 19, 2018

Fixes #117

We want to be able to delete folders of many items. CC @eraboin

If this change seems generally reasonable, I can add more tests

boolean deleteSuccessful = delete(child.getPath(), true);

if (!deleteSuccessful) {
return false;
Copy link

@eraboin eraboin Apr 19, 2018

Choose a reason for hiding this comment

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

The definition of delete in the Hadoop documentation does not specify whether we should stop immediately here, or continue with the rest of the delete. If we're modeling this after rm -rf then I'd expect it to continue deleting what it can though, right?

Not sure if there's a reference impl elsewhere we can look at.

Copy link
Author

@TheBeruriahIncident TheBeruriahIncident Apr 19, 2018

Choose a reason for hiding this comment

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

Easy to do either, but yeah, I'm unsure what behavior is preferable. RawLocalFileSystem continues and eventually returns false if anything failed. FTPFileSystem continues and ignores any intermediate issues (maybe a bug). DistributedFileSystem is hard to follow, but seems to atomically destroy everything, making this is a non-issue. S3FileSystem matches the behavior of this PR, returning early if anything fails.

Copy link
Contributor

@ellisjoe ellisjoe Apr 20, 2018

Choose a reason for hiding this comment

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

I'd really prefer to avoid supporting recursive deletes within EncryptedFileSystem until we can do so efficiently. I'd propose that you do:

RemoteIterator<LocatedFileStatus> files = efs.listFiles(path, true);
while (files.hasNext()) {
    efs.delete(files.next().getPath(), false);
}

as a workaround for the time being.

@TheBeruriahIncident TheBeruriahIncident deleted the recursive-delete branch April 20, 2018 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants