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

Michael McCandless commented on LUCENE-5904:
--------------------------------------------

To summarize this issue:

First Rob added nice new evilness to MDW so that sometimes Directory.deleteFile 
would fail even if Lucene did not have that file open, simulating a virus 
checker temporarily holding the file open.  (Previously this operation would 
always succeed).

But this new evilness uncovered a nasty corruption case in Lucene, whereby 1) 
an unclean shutdown of a previous IW left some "future" segment files in the 
index, e.g. _5.pos, 2) the new IW starts up and identifies this file as not 
being referenced and immediately tries to delete it, but 3) the virus checker 
prevents _5.pos being deleted on init.  Normally this is "ok": IW records that 
this file needs deleting but failed last time and so it periodically retries.

The problem is, when the IW goes and flushes a few segments, it may now in fact 
overwrite _5.pos with a "real" one, which may succeed (if virus checker is done 
with that file), and then later when IW retries its deletes, it removes _5.pos, 
corrupting the index.

I don't know of any actual user cases showing this corruption case ... but it's 
quite insidious ...

> Add MDW.enableVirusScanner / fix windows handling bugs
> ------------------------------------------------------
>
>                 Key: LUCENE-5904
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5904
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-5904.patch, LUCENE-5904.patch, LUCENE-5904.patch, 
> LUCENE-5904.patch, LUCENE-5904.patch, LUCENE-5904.patch
>
>
> IndexWriter has logic to handle the case where it can't delete a file (it 
> puts in a retry list and indexfiledeleter will periodically retry, you can 
> force this retry with deletePendingFiles).
> But from what I can tell, this logic is incomplete, e.g. its not properly 
> handled during CFS creation, so if a file temporarily can't be deleted things 
> like flush will fail.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to