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

Jason Rutherglen updated LUCENE-1314:
-------------------------------------

    Attachment: LUCENE-1314.patch

This patch includes the previous patch. All tests pass.

* IndexReader.clone(boolean openReadOnly) method added that returns a
read only reader.

* Previously on a clone, the DirectoryIndexReader.doReopen was
looking up the latest segmentinfos file from the directory
implementation. This was unnecessary because the current segmentinfos
is being cloned. In this patch DirectoryIndexReader.clone uses the
new doReopenSegmentInfos (which can also be used by LUCENE-1516).
When clone returns a read only reader, the write lock etc is not
shared. 

* SegmentReader. reopenSegment has a openReadOnly argument.

* Added a test case in TestIndexReaderClone checking for read only
readers being returned from the method clone openReadOnly=true. 

I decided against having reopen have a read only method because it
does not always return a reader like clone does. If the existing
reader is not read only and the returned reader is supposed to be
read only, the current contract of the reopen method would break
because if there are no changes it is supposed to return the existing
reader. Also returning a read only reader is desired, clone may be
used.


> 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
>
>
> 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

Reply via email to