-
Notifications
You must be signed in to change notification settings - Fork 23
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
Issue 163: delete files recursively #164
Conversation
Hi @dmndZhWng , Thank you for you contribution! Could you please make the test a bit more extensive and include the following:
Also, would you mind signing the ICLA, as described in the Contributing page? Also, please, feel free to join our chat channel, if you'd like to learn more about the project and/or like to find out what else you could help with. Kind regards, Martin |
Hi, I ve submit a new PR with some code formatting + fix + Unit Test. |
Thanks for your fixes! We'll review them and get back to you!
Great! Thank you very much!
You would have to create a free tier account and test this. Have you had a chance to sign the ICLA as I mentioned earlier? Kind regards, Martin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmndZhWng thanks for your PR! :)
I did some digging today and updated the original issue #163.
The AWS API has limitations - 1000
objects per listing
and deletion
.
With the proposed implementation you will be deleting only the first 1000 objects and ignoring the rest. What you should do is use a loop and continue deleting until there are no objects in the path
or an error occurs (@carlspring should we fail or just print a warning?).
There is no point in warning, or throwing an error here. It should just loop until there are no more. |
We should at least print warnings with potential exceptions or error messages returned by the API (if any) |
I ve made some small changes concerning my previous dev : 1/ I successfully made an Integration test too :). 2/ I replaced the Files.walk by an recursion call because the documentation says that we cannot rely on the order returned (but the order of path to delete has a real importance in my case) 3/ I added the delete by batch logic 4/ Concerning the error/warning handling, I notice that the only error thrown is a NoSuchFileException, it happened only when we provide an inexisting path. |
Thanks, @dmndZhWng ! @ptirador , would you like to review and test this? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @dmndZhWng! Thanks for your PR! Could you please fix the changes that I requested?
It woukd also be great to create an integration test in FilesITTest
class, something similar to deleteDir
method but with filled directories instead of empty.
Thanks.
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
src/test/java/org/carlspring/cloud/storage/s3fs/fileSystemProvider/DeleteTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/carlspring/cloud/storage/s3fs/fileSystemProvider/DeleteTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/carlspring/cloud/storage/s3fs/fileSystemProvider/DeleteTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/carlspring/cloud/storage/s3fs/util/S3ClientMock.java
Outdated
Show resolved
Hide resolved
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
src/test/java/org/carlspring/cloud/storage/s3fs/fileSystemProvider/DeleteTest.java
Show resolved
Hide resolved
src/test/java/org/carlspring/cloud/storage/s3fs/util/S3ClientMock.java
Outdated
Show resolved
Hide resolved
Ping @dmndZhWng! Did you have a chance to look at the changes that I requested? |
@ptirador sorry for my late answer, i just seen your last request concerning the import file.*, and i ve just made the change. please have a look and do not hesitate if any missing. thanks ;). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @dmndZhWng! Thank you so much.
cc @carlspring @steve-todorov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steve-todorov ,@ptirador I have a question concerning the point 4. of what you mentioned in the Issue. Maybe we could :
Because in the current version, we might get directly a SDKException if something happens when delete ... Do not hesitate if you have any idea / preference. |
Oh sorry, I missed that question! If the thrown exception is @ptirador / @carlspring thoughts? |
I think maybe this case has to be handled with the same way too (i.e. log and skipped) ? |
I agree with this solution. Thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dmndZhWng , could you take a look at these small changes?
Thanks!
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/carlspring/cloud/storage/s3fs/S3FileSystemProvider.java
Outdated
Show resolved
Hide resolved
hello done :) @ptirador . do not hesitate if any other questions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @dmndZhWng! Thanks.
cc @carlspring
Thanks for reviewing, @ptirador ! This will be merged once @steve-todorov had merged #184 and #186 and tested this pull request. |
0e79cd9
to
d139e95
Compare
I have Thanks to everybody for your active work on this! I'm proceeding with merging into the |
@dmndZhWng , Thank you very much for your contribution! Would you like to have a look at #160 as well? @ptirador , @steve-todorov : Thanks for reviewing and merging this! :) |
@carlspring yes sure, there are some common logic i think |
Excellent! Thank you! |
Pull Request Description
This pull request closes #163
Acceptance Test
mvn clean install -Pintegration-tests
still works.Questions
Does this pull request break backward compatibility?
Does this pull request require other pull requests to be merged first?
Does this require an update of the documentation?