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

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

bq. It's been added in this patch so there isn't a back compat issue.

OK, I was confused.  This new exception is thrown if you 1) have a
non-readOnly reader1, 2) reopen it with readOnly=false (thus marking
reader1 as readOnly=true), and 3) try to make a change with the
now-readOnly reader.

OK I like throwing UOE.  It's the same as what you get if you open
a readOnly reader and try to make a change.

{quote}
While it seem logical, it's not allowed because the read only reader
doesn't hold the write lock which it needs to pass on to the
writeable reader. 
{quote}

But that's OK?  Ie, cloning to a non-readOnly reader when it doesn't
already have the write lock simply means the new reader is allowed to
attempt acquiring the write lock (even though it doesn't already have
the write lock).

Ie "being non-readOnly" and "holding the write lock" are two separate
things.

I can see this being useful if you are an app that doens't often need
to make changes w/ the reader... so you hold a readOnly reader most of
the time, but then when you need to make a change you clone it to
non-readOnly clone to make changes.

I also wonder what should happen if you 1) have a non-readOnly
reader1, but 2) it has no changes pending (does not hold the write
lock) and 3) you clone it to a non-readOnly clone reader2.  I think
reader1 should not be marked readOnly this case, because it has no
pending changes.  Ie I think at this point reader1 & reader2 should be
interchangeable?


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