You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (Commented) (JIRA)" <ji...@apache.org> on 2011/12/13 14:05:30 UTC

[jira] [Commented] (LUCENE-3644) problems with IR's readerFinishedListener

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

Uwe Schindler commented on LUCENE-3644:
---------------------------------------

Hi,

+1, I was f*cking with this the whole day when rewriting oirectoryReader/MultiReader.

The bad thing is also that the Set(CHM) is not initialized in IndexReader base class (and is not final), the subclasses must do it. This should be done by base class and be protected final, then normal IndexReaders dont need to f*ck with it. Just make the listeners collection in IndexReader base class final and initialize with MapBackedSet(CHM).
DirectoryReader and other MultiReaders may simply delegate the registration to the subreaders, but dont pass sets around. If they need to copy all, just do "for (Listener l: this.listenerss) subreader[i].add(l);", sharing the same map between different readers is wrong.
                
> problems with IR's readerFinishedListener
> -----------------------------------------
>
>                 Key: LUCENE-3644
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3644
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>             Fix For: 3.6, 4.0
>
>
> There are two major problems:
> 1. The listener api does not really apply all indexreaders. for example segmentreaders dont fire it on close, only segmentcorereaders. this is wrong, a segmentcorereader is *not* an indexreader. Furthermore, if you register it on a top-level reader you get events for anything under the reader tree (sometimes, unless they are segmentreaders as mentioned above, where it doesnt work correctly at all).
> 2. Furthermore your listener is 'passed along' in a viral fashion from clone() and reopen(). This means for example, if you are trying to listen to readers in NRT search you are just accumulating reader listeners, all potentially keeping references to old indexreaders (because, in order to deal with #1 your listener must 'keep' a reference to the IR it was registered on, so it can check if thats *really* the one).
> We should discuss how to fix #1. 
> I will create a patch for #2 shortly and commit it, its just plain wrong.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org