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

If the chunk fails and we keep the 'slot' as free, make sure to remove the files from disk #17

Open
wants to merge 4 commits into
base: airbnb-main
Choose a base branch
from

Conversation

autata
Copy link
Collaborator

@autata autata commented Nov 22, 2024

Summary

If the chunk fails and we keep the 'slot' as free, make sure to remove the files from disk

Describe the goal of this PR. Mention any related Issue numbers.

Requirements

@@ -437,6 +437,12 @@ private void handleChunkAssignment(CacheSlotMetadata cacheSlotMetadata) {
// disregarding any errors
setChunkMetadataState(cacheSlotMetadata, Metadata.CacheSlotMetadata.CacheSlotState.FREE);
LOG.error("Error handling chunk assignment", e);
// also clean up downloaded files if the chunk could not be assigned as we're marking the as
// FREE / available
if (Files.isDirectory(dataDirectory)) {
Copy link

Choose a reason for hiding this comment

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

There is already a cleanDirectory method in this class that can do this. Can we call that method here?

Copy link

Choose a reason for hiding this comment

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

Also, can you please add a unit test for this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cleanDirectory only deletes the files in the directory. i used that one first, but it doesn't have the desired result

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.

2 participants