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
Prevent fsync from creating 0-byte files #5746
Conversation
@imotov if you have time I'd love if you could take a look at this again. I added a new commit that cleans up that writeBlob method and also tries to fsync the directory that we have written too. |
if (innerSuccess) { | ||
IOUtils.close(is, raf); | ||
} else { | ||
IOUtils.closeWhileHandlingException(is, raf); |
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.
There is now an unused import for IOUtils in this file.
LGTM |
@@ -75,11 +80,7 @@ public static int maxOpenFiles(File testDir) { | |||
} catch (IOException ioe) { | |||
int i = 0; | |||
for (RandomAccessFile raf : 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.
fyi I think you can IOUtils.closeWhileHandlingException(files) since its Iterable...
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.
true man I am going to remove this method anyway soon
+1 for the fsync fix, I'm glad we factored this logic into a utility method in Lucene 4.8.... |
This is related to LUCENE-5570 where fsync creates a 0-byte file if the file does not exists. This commit adds the patched lucene version using Java 7 APIs as well as a note to replace this method with the upcomeing IOUtils#fsync in Lucene 4.8 This commit cleans up FsImmutableBlobContainer#writeBlob to make use of Java7 Auto-Closing features and ensures that the directory the blob was written to is fsynced as well if possible.
This is related to LUCENE-5570 where fsync creates a 0-byte file
if the file does not exists. This commit adds the patched lucene
version using Java 7 APIs as well as a note to replace this method
with the upcomeing IOUtils#fsync in Lucene 4.8