You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2013/03/22 11:27:15 UTC

[jira] [Commented] (LUCENE-4870) Lucene deletes entire index if and exception is thrown due do TooManyOpenFiles and OpenMode.CREATE_OR_APPEND

    [ https://issues.apache.org/jira/browse/LUCENE-4870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13610102#comment-13610102 ] 

Michael McCandless commented on LUCENE-4870:
--------------------------------------------

Not good!

Is there no reliable way to differentiate "file does not exist" from "I ran out of file handles" from the exception we get from trying to open RAF/FileChannel.open?

Is File.exists() even trustworthy once you've run out of descriptors?

Maybe ... we should fix SegmentInfos.read, where it calls dir.openInput, to throw a different exception (OpenSegmentsFailedIOException) if the open failed vs if a subsequent op (reading bytes from segments file, or opening the SegmentReaders) failed.  This way we could catch this exception above and know that a segments file in fact exists yet we were unable to open it (and return "true" for indexExists in this case).
                
> Lucene deletes entire index if and exception is thrown due do TooManyOpenFiles and OpenMode.CREATE_OR_APPEND
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-4870
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4870
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 4.0, 4.1, 4.2
>            Reporter: Simon Willnauer
>            Priority: Blocker
>             Fix For: 5.0, 4.3, 4.2.1
>
>         Attachments: LUCENE-4870.patch
>
>
> The Lucene IndexWriter might delete an entire index if it hits a FileNotFoundException triggered by TooManyOpenFiles during IndexWriter creation. We try to figure out if the index exists already if the OpenMode.CREATE_OR_APPEND is set (which is default). Yet, the logic in DirectoryReader#indexExists(Directory) will just return false if we are not able to open the segment file. This will cause the IW to assume there is no index and it will try to create a new index there trashing all existing commit points treating this as a OpenMode.CREATE.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org