[ https://issues.apache.org/jira/browse/LUCENE-1314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael McCandless updated LUCENE-1314: --------------------------------------- Attachment: LUCENE-1314.patch Attached patch. I plan to commit in a day or two. OK I changed deletedDocRefs to only be inc/decRef'd once for the reader, not every time the reader is inc/decRef'd (which was causing the bug you saw). But then because of how a reopened SegmentReader references the original, the deleted docs were being unecessarily copy-on-write'd (on closing the first reader we would fail to decref the deletedDocsRef so when the 2nd reader did a delete, it would copy). So then I added a new coreRef to SegmentReader, instead of the referencedSegmengReader. I like this approach better because it allows the original reader to be closed, without closing the core objects when other readers share them. It also simplifies SegmentReader's inc/decRef so that they no longer need to be overridden. Also, when cloning the BitVector, I changed it to not copy count over -- if a separate thread is changing the deleted docs at the same time, the count could be off. Back-compat tests don't pass, because TestIndexReaderReopen is checking internal reference counts; I'll commit fixes to tests when I commit. > IndexReader.clone > ----------------- > > Key: LUCENE-1314 > URL: https://issues.apache.org/jira/browse/LUCENE-1314 > Project: Lucene - Java > Issue Type: New Feature > Components: Index > Affects Versions: 2.3.1 > Reporter: Jason Rutherglen > Assignee: Michael McCandless > Priority: Minor > Fix For: 2.9 > > Attachments: LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, > LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, > LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, > LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, > LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, > LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, LUCENE-1314.patch, > LUCENE-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, > lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, > lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, lucene-1314.patch, > lucene-1314.patch > > > Based on discussion > http://www.nabble.com/IndexReader.reopen-issue-td18070256.html. The problem > is reopen returns the same reader if there are no changes, so if docs are > deleted from the new reader, they are also reflected in the previous reader > which is not always desired behavior. -- 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: java-dev-unsubscr...@lucene.apache.org For additional commands, e-mail: java-dev-h...@lucene.apache.org