[
https://issues.apache.org/jira/browse/LUCENE-5912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14115050#comment-14115050
]
ASF subversion and git services commented on LUCENE-5912:
---------------------------------------------------------
Commit 1621270 from [~mikemccand] in branch 'dev/branches/branch_4x'
[ https://svn.apache.org/r1621270 ]
LUCENE-5912: add test case confirming openIfChanged with an NRT reader on a
commit point in fact shares SegmentReader
> Non-NRT directory readers don't reuse segments maintained IndexWriter's
> segment reader pool
> -------------------------------------------------------------------------------------------
>
> Key: LUCENE-5912
> URL: https://issues.apache.org/jira/browse/LUCENE-5912
> Project: Lucene - Core
> Issue Type: Improvement
> Components: core/index
> Affects Versions: 4.6.1
> Reporter: Vitaly Funstein
>
> Currently, if you attempt to open a reader into an index at a specific commit
> point, it will always behave as though it's opening a completely new index -
> even if one were to use the {{DirectoryReader.openIfChanged(DirectoryReader,
> IndexCommit)}} API, and pass in an NRT reader instance. What should ideally
> happen here is that the SegmentReader pool managed by IndexWriter linked to
> the NRT reader gets reused for the commit point open as much as possible, to
> avoid wasting heap space.
> The problem becomes evident when looking at the code in DirectoryReader:
> {code}
> protected DirectoryReader doOpenIfChanged(final IndexCommit commit) throws
> IOException {
> ensureOpen();
> // If we were obtained by writer.getReader(), re-ask the
> // writer to get a new reader.
> if (writer != null) {
> return doOpenFromWriter(commit);
> } else {
> return doOpenNoWriter(commit);
> }
> }
> private DirectoryReader doOpenFromWriter(IndexCommit commit) throws
> IOException {
> if (commit != null) {
> return doOpenFromCommit(commit);
> }
> ......
> {code}
> Looks like the fact that a commit point is being re-opened trumps the
> presence of the associated IndexWriter.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]