Arvind Srinivasan wrote:
The patch on the follow up mail does look good. However, I have additional
concerns:
(a) deleteFile call may fail. eg. File is left open from the previous exception.
This makes me believe the ideal scenario is to not to reuse the segment name
once the newSegment call issues one. I strongly recommend this for 2.0.
I don't think this is possible. When a JVM process exits, the OS closes
all files it had open. So the file can only still be open if the JVM
that failed is still running. All files opened while indexing are
closed in a finally block. So, if the JVM is still running and the file
is open then it is still working on that segment and has not yet failed.
No other JVM should ever open these segment files since they were
never named in the 'segments' file.
(b) We should add a comment on Directory interface, so that people who
implement
their own directory do not run into this issue and for that reason, I like
RandomAccessFile.setLength(0). However, since the code currently calls createFile
from many locations, we could add a comment something like this:
---
/** Creates a new, empty file in the directory with the given name.
Returns a stream writing this file.
Ensure the OutputStream points to 0 byte length file.
*/
public abstract OutputStream createFile(String name)
throws IOException;
---
It already says "new empty file". That seems clear enough to me.
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]