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

Simon Willnauer commented on LUCENE-4676:
-----------------------------------------

after looking at IW infostreams for a while I am convinced this is a test-bug 
(a pretty rare one I'd say). So what happens here is the following 
(applyDeletes=false):

{noformat}
1. Thread[1] adds a doc (D1)
2. Thread[1] pull a new reader
3. Thread[1] adds another doc (D2)
3a. Thread[2] pull a new reader
3b. Thread[2] adds a del query
3c. Thread[2] pull a new reader
4. Thread[1] checks if reader is current 
{noformat}
(3a - 3c are concurrent) given that we don't apply deletes on a NRT reader pull 
we should see _isCurrent == false_ ....

Well this works most of the time unless there is a concurrent merge kicked off 
right after doc was added in _3_ that sees both flushed segments (D1 and D2) 
and subsequently tries to apply deletes to those segments. Here comes the 
problem, if the applyDeletes is fast enough (ie. reaches 
BufferedDeletesStream#prune()) before _4_ it drops the delete query from the 
streams (correct behavior!) but doesn't checkpoint since no segment was 
affected. If we check isCurrent now we see a _true_ value since the 
BufferedDeletesStream is empty (pruned) and the merge didn't finish yet (no 
checkpoint) which means the version of the SegmentInfos is the same.

does this make sense? I switched over to NoMergePolicy on this test and tests 
pass all the time (500k times executed) while with a real MP it fails very 
quickly for me.

                
> IndexReader.isCurrent race
> --------------------------
>
>                 Key: LUCENE-4676
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4676
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>            Assignee: Simon Willnauer
>             Fix For: 4.1
>
>
> Revision: 1431169
> ant test  -Dtestcase=TestNRTManager 
> -Dtests.method=testThreadStarvationNoDeleteNRTReader 
> -Dtests.seed=925ECD106FBFA3FF -Dtests.slow=true -Dtests.locale=fr_CA 
> -Dtests.timezone=America/Kentucky/Louisville -Dtests.file.encoding=US-ASCII 
> -Dtests.dups=500

--
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to