lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] [Commented] (LUCENE-6565) Is it ok for IndexWriter.prepareCommit to be an NRT-visible change?
Date Sat, 20 Jun 2015 18:01:00 GMT


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)

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:
>             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 =, true);
> assertNull(DirectoryReader.openIfChanged(reader)); // ok
> w.prepareCommit();
> assertNull(DirectoryReader.openIfChanged(reader)); // fails
> {code}

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message