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

Michael McCandless commented on LUCENE-6565:
--------------------------------------------

I suspect this is not right: NRT readers should not "see" that prepareCommit 
(but not the 2nd phase commit) had been called, and should only see the event 
once the 2nd phase (commit) succeeds.

And I suspect if you reopen your NRT reader after prepareCommit, then you 
commit, then if you try to reopen the NRT reader it will see no changes from 
the 2nd phase yet will still see the old segments_N file.

However, this is tricky to fix, because of how prepareCommit forks (clones) the 
SegmentInfos, allowing concurrent indexing changes while the 2nd commit phase 
runs likely slowly (fsync), and because we use a single linear comparable (the 
long SIS.getVersion) to correspond to changes ... but I don't yet see a simple 
way to fix this, and I'd rather not make this part of IW any more complex.

> Is it ok for IndexWriter.prepareCommit to be an NRT-visible change?
> -------------------------------------------------------------------
>
>                 Key: LUCENE-6565
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6565
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Adrien Grand
>            Assignee: Michael McCandless
>
> Because of LUCENE-6523, IndexWriter.prepareCommit is now an NRT-visible 
> change. For instance the following test would fail:
> {code}
> Directory dir = newDirectory();
> IndexWriter w = new IndexWriter(dir, new IndexWriterConfig(new 
> MockAnalyzer(random())));
> w.addDocument(new Document());
> DirectoryReader reader = DirectoryReader.open(w, true);
> assertNull(DirectoryReader.openIfChanged(reader)); // ok
> w.prepareCommit();
> assertNull(DirectoryReader.openIfChanged(reader)); // fails
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to