You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2014/08/29 11:05:54 UTC

[jira] [Commented] (LUCENE-5912) Non-NRT directory readers don't reuse segments maintained IndexWriter's segment reader pool

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

Michael McCandless commented on LUCENE-5912:
--------------------------------------------

Sheesh, so it is actually sharing SegmentReaders from the writer's pool?  Talk about confusing code ... none of can figure out how it works.

Maybe we should add a simple test case confirming that readers are in fact in common, to be sure :)  I'll work on this.

> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org