[ https://issues.apache.org/jira/browse/LUCENE-743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12536063 ]
Michael McCandless commented on LUCENE-743: ------------------------------------------- > But if a reader is shared, how do you tell two real closes from an erronous > double-close? > Perhaps have a top level close() that is only invoked once via isClosed, and > a projected doClose() that a multi-reader would use that actually does the > decref? Yes I think that's the right approach. > It is quite different when it comes to SegmentReaders. SegmentReader.reopen() > checks SegmentInfos if there is a segment with the same name but newer > normGen or delGen. If there is one then a new SegmentReader instance is > created that reuses resources like e. g. TermInfosReader and loads the new > generation of the del or norm file. > > Now you can end up having a bunch of SegmentReaders that share the same > resources but don't know about each other. The reference counting would have > to happen somewhere else, e. g. in the TermInfosReader. Of course this is > doable, but it's a special case and more complicated compared to the > "restrict reopen() to only be called once"-approach. For SegmentReader, I think on reopen(), everything would be shared except norms and/or deletedDocs right? In which case couldn't all cascaded reopens hold onto the original SegmentReader & call doClose() on it when they are closed? (Ie it is the "owner" of all the shared parts of a SegmentReader). Then, deletedDocs needs no protection (it has no close()), and for Norms we could push the reference counting down into it as well? We wouldn't need to push reference counting into all the readers that a SegmentReader holds because those are always shared when a SegmentReader is reopened? > IndexReader.reopen() > -------------------- > > Key: LUCENE-743 > URL: https://issues.apache.org/jira/browse/LUCENE-743 > Project: Lucene - Java > Issue Type: Improvement > Components: Index > Reporter: Otis Gospodnetic > Assignee: Michael Busch > Priority: Minor > Fix For: 2.3 > > Attachments: IndexReaderUtils.java, lucene-743-take2.patch, > lucene-743.patch, lucene-743.patch, lucene-743.patch, MyMultiReader.java, > MySegmentReader.java, varient-no-isCloneSupported.BROKEN.patch > > > This is Robert Engels' implementation of IndexReader.reopen() functionality, > as a set of 3 new classes (this was easier for him to implement, but should > probably be folded into the core, if this looks good). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]