[ 
https://issues.apache.org/jira/browse/LUCENE-743?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Busch updated LUCENE-743:
---------------------------------

    Attachment: lucene-743-take5.patch

OK, I think it's finally working now! :-)

SegmentReader now overwrites incRef() and increments the readers RC,
as well as the RCs of all norms. I further added the private method
incRefReaderNotNorms() to SegmentReader, which is called in 
reopenSegment(), because it takes care of incrementing the RCs of
all shared norms.

I also added the method doCloseUnsharedResources() to IndexReader,
which is a NOOP by default. It is called when a reader is closed,
even if its RC > 0. SegmentReader overwrites this method and 
closes (=decRef) the norms in it. The SegmentReader then remembers
that it closed the norms already and won't close them again in
doClose(), which is called when its RC finally drops to 0.

I also made the change you suggested, Mike, to only reload the 
field norms that actually changed. SegmentReader.openNorms() now
checks if there is already a norm for a field in the HashTable,
and only loads it if it's not there. reopenSegment() puts all
norms in the new SegmentReader that haven't changed.

I added some new tests to verify the norms ref counting. All unit
tests pass now. So I think this is ready to commit, but I'd feel 
more comfortable if you could review it again before I commit it.

> 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-take3.patch, lucene-743-take4.patch, lucene-743-take5.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]

Reply via email to