lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <>
Subject Re: Potential Segment corruption
Date Thu, 26 May 2005 16:41:39 GMT
Arvind Srinivasan wrote:
> Some options are: 
> (1)Commit the counter after the newSegmentName call. This way we never reuse the
> the segmentName.
> (2)  Add a callback API to directory interface for a new Segment Creation allowing
> the directory interface to clean up, on a new segment write.
> (3)  Provide a Rollback mechanism in the event of merge failure. (Using the deleteable
>      functionality).
> (4) For Compound File Store (The file must be empty). (Possibly, it can use the callback

>      in  (2) to cleanup.

I think the fix is much simpler.  This is a bug in FSDirectory. 
Directory.createOutput() should always create a new empty file, and 
FSDirectory's implementation does not ensure this.  It should try to 
delete the file before opening it and/or call RandomAccessFile.setLength(0).

I've attached a patch.  Does this fix things for you?


View raw message