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

Fix directory deletion failure in DiskSpaceAllocator #1244

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,7 @@ private void inventoryExistingReserveFiles() throws IOException {
inventorySwapReserveFiles(file);
} else {
// if it is neither store reserved segment directory nor swap segment directory, then delete it.
if (!file.delete()) {
throw new IOException("Could not delete the following reserve file or directory: " + file.getAbsolutePath());
}
Utils.deleteFileOrDirectory(file);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ public void inventoryExistingFilesTest() throws Exception {
File invalidFile = new File(reserveFileDir, DiskSpaceAllocator.RESERVE_FILE_PREFIX + UUID.randomUUID());
assertTrue(invalidDir.mkdir());
assertTrue(invalidFile.createNewFile());
// create extra file inside invalid directory to mock non-empty directory
File extraFile = new File(invalidDir, DiskSpaceAllocator.RESERVE_FILE_PREFIX + UUID.randomUUID());
assertTrue(extraFile.createNewFile());
// instantiate DiskSpaceAllocator
alloc = constructAllocator();
// verify invalid directories and files no longer exist
Expand Down