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

Michael McCandless commented on LUCENE-1314:
--------------------------------------------

bq. It is possible to have SegmentReader implement if deletes occur to an 
earlier IndexReader and a flush is tried it fails, rather than fail in a newer 
IndexReader like it would now. This would require keeping track of later 
IndexReaders which is something Ocean does outside of IndexReader.

I think this is tricky, since SegmentReader doesn't explicitly track whether 
there is a "cloned" reader out there.  As things stand now, there is no such 
thing as a cloned reader, and so the only way that another SegmentReader is out 
there is if there have been commits to the index, in which case isCurrent() 
returns false and the old reader will not allow deletes to be performed.  I 
suppose we could look at the refCount of the IndexReader: any reader that has 
been cloned and not yet closed will have a refCount > 1, whereas the last 
reader returned from a clone() call will have refCount 1.

So unless we try to track this, when there are N clones out there, any one of 
them will be allowed to grab the write lock when a change (deletion or setNorm) 
is attempted, thus preventing all the other clones (and all readers open on 
previous commits) from making changes.

> IndexReader.reopen(boolean force)
> ---------------------------------
>
>                 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
>         Attachments: 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to