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.
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
Provide a way to automatically delete multipart temporary files #5653
Provide a way to automatically delete multipart temporary files #5653
Changes from 1 commit
330402c
4dc1fa2
b75c256
feaeb6c
005d22e
25b2189
37d78bd
f8cac35
20c37c8
ec4abe2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Wouldn't it result in a kind of resource leak, since the JVM needs to keep the list of files to remove on exit?
What do you think about this:
purgeMultipartUploadsOnExit
(default: true) that registers a shutdown hook that scans the directory and remove the items.ON_JVM_SHUTDOWN
from(default)multipartRemovalStrategy
.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.
I think
purgeMultipartUploadsOnExit
andMultipartRemovalStrategy
are mutually exclusive. IfMultipartRemovalStrategy.ON_RESPONSE_COMPLETION
is set,purgeMultipartUploadsOnExit
means nothing. If some users want to keep the temporary files for n days as a backup even after the server restarts, they have to set bothMultipartRemovalStrategy.NEVER
andpurgeMultipartUploadsOnExit=false
.How about moving multipart files to a special directory such as
temporary
ifON_JVM_SHUTDOWN
is set? The shutdown hook will delete alltemporary
directories undermultipartUploadsLocation
s.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.
I'm +1 for @ikhoon 's idea to at least group the user-facing APIs in one place. I do think we will need to add a shutdown hook somewhere if
ON_JVM_SHUTDOWN
is selected though.Eventually, I imagine an API like the following (if very advanced features are needed)
I'm not sure I understood the need to separate the directory between
complete
andtemporary
.Also, would it make sense to somehow embed the server id for each multipart file in case multiple servers are running in the same jvm? This way, we can still delete files that are for a specific jvm and the flag
ON_JVM_SHUTDOWN
makes more sense.e.g.
<pid>-<server id>-
as the prefix for the temporary files.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.
I'm unsure if
ON_JVM_SHUTDOWN
is a really useful option, it is worth implementing the complicated functions. For now, I would like to deleteON_JVM_SHUTDOWN
from the PR and make it unsupported. If users have requests for it, we would like to consider them.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.
Sounds good to me.