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

Doron Cohen edited comment on LUCENE-2887 at 1/25/11 7:49 AM:
--------------------------------------------------------------

I think it is correct to say that "if the result of ir.numDeletedDocs() is *N*, 
then calling ir.undeleteAll() will undelete exactly *N* documents"... or am I 
missing it? 

Because if a merge was invoked for the segments seen by this reader, I see two 
options:
# A merge is on going, or the merge is done but uncommitted yet.
   This means that an index writer has a lock on the index, hence 
ir.undeleteAll() will fail to get the lock.
# The merge was already committed.
   This means that the index reader will fail to get write permission for being 
Stale.

So I think this method behaves deterministically - perhaps its jdoc should say 
something like: 
*Undeletes all #numDeletedDocs() documents currently marked as deleted in this 
index.* ?

      was (Author: doronc):
    I think it is correct to say that "if the result of ir.numDeletedDocs() is 
N, then calling ir.undeleteAll() will delete exactly N documents"... or am I 
missing it? 

Because if a merge was invoked for the segments seen by this reader, I see two 
options:
# A merge is on going, or the merge is done but uncommitted yet.
   This means that an index writer has a lock on the index, hence 
ir.undeleteAll() will fail to get the lock.
# The a merge was already committed.
   This means that the index reader will fail to get write permission for being 
Stale.

So I think this method behaves deterministically - perhaps its jdoc should say 
something like: 
*Undeletes all #numDeletedDocs() documents currently marked as deleted in this 
index.* ?
  
> Remove/deprecate IndexReader.undeleteAll
> ----------------------------------------
>
>                 Key: LUCENE-2887
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2887
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.1
>
>
> This API is rather dangerous in that it's "best effort" since it can only 
> un-delete docs that have not yet been merged away, or, dropped (as of 
> LUCENE-2010).
> Given that it exposes impl details of how Lucene prunes deleted docs, I think 
> we should remove this API.
> Are there legitimate use cases....?

-- 
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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to