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

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

{quote}
> 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.
{quote}

Good!  So now we don't even run the FindSegmentsFile at all during
clone.

{quote}
> I think we should add reopen(boolean readonly) and clone(boolean
> readonly) as otherwise the only way to obtain a readonly reader is to
> call IR.open. 
{quote}

I agree.  It then seems like for realtime search you may want to clone
a readOnly IR to do your searching (for better concurrency), and keep
the writable IR for doing further changes.

{quote}
> IndexReader.clone(boolean openReadOnly) method added that returns a
> read only reader.
{quote}

If I have a readOnly reader and I clone with readOnly=false, should
that give me a non-readOnly clone?  I think it should?  But I think
current patch doesn't handle that right?  If so, could you add a test
case & fix it?

Then, if I have a non-readOnly reader and I clone it with
readOnly=true, it seems like the semantics is to have the original
reader keep the write lock, ie it's allowed to continue making changes
if it wants, and the first change after that clone should
copy-on-write?  Can you add a test case verifying that?

{quote}
> I decided against having reopen have a read only method because it
> does not always return a reader like clone does.
{quote}

OK.


> 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