You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Nikolay Zamosenchuk (JIRA)" <ji...@apache.org> on 2010/09/08 09:54:32 UTC

[jira] Created: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

IndexReader.isCurrent() lies if documents were only removed by latest commit
----------------------------------------------------------------------------

                 Key: LUCENE-2634
                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
             Project: Lucene - Java
          Issue Type: Bug
    Affects Versions: 2.9.3
         Environment: Ubuntu 9.10
Sun-java-jdk 1.6.0_20-b02
            Reporter: Nikolay Zamosenchuk


Usecase is as following:

1. Get indexReader via indexWriter.
2. Delete documents by Term via indexWriter. 
3. Commit indexWriter.
4. indexReader.isCurrent() returns true.

Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
Testcase is attached.

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


Re: [jira] Created: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by Erick Erickson <er...@gmail.com>.
I'd expect this behavior if you haven't re-opened your underlying
readers after the commit. No index changes are visible after
a reader has been opened.

Your steps to reproduce do not show any reopen, what happens
when you do?

Best
Erick

On Wed, Sep 8, 2010 at 3:54 AM, Nikolay Zamosenchuk (JIRA)
<ji...@apache.org>wrote:

> IndexReader.isCurrent() lies if documents were only removed by latest
> commit
>
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-2634
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9.3
>         Environment: Ubuntu 9.10
> Sun-java-jdk 1.6.0_20-b02
>            Reporter: Nikolay Zamosenchuk
>
>
> Usecase is as following:
>
> 1. Get indexReader via indexWriter.
> 2. Delete documents by Term via indexWriter.
> 3. Commit indexWriter.
> 4. indexReader.isCurrent() returns true.
>
> Usually there is a check if index reader is current. If not then it is
> reopened (re-obtained via writer or ect.). But this causes the problem when
> documents can still be found through the search after deletion.
> Testcase is attached.
>
> --
> 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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Re: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by Erick Erickson <er...@gmail.com>.
Thanks, ya' learn something new every day <G>. Also, I hadn't seen
the other responses, coffee hadn't kicked in.

Erick

On Wed, Sep 8, 2010 at 8:30 AM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> Actually, IR.isCurrent() is supposed to return false if any changes
> have been committed to the index since the IR was opened.
>
> Mike
>
> On Wed, Sep 8, 2010 at 8:11 AM, Erick Erickson <er...@gmail.com>
> wrote:
> > I'd expect this behavior if you haven't re-opened your underlying
> > readers after the commit. No index changes are visible after
> > a reader has been opened.
> >
> > Your steps to reproduce do not show any reopen, what happens
> > when you do?
> >
> > Best
> > Erick
> >
> > On Wed, Sep 8, 2010 at 3:54 AM, Nikolay Zamosenchuk (JIRA)
> > <ji...@apache.org>wrote:
> >
> >> IndexReader.isCurrent() lies if documents were only removed by latest
> >> commit
> >>
> >>
> ----------------------------------------------------------------------------
> >>
> >>                 Key: LUCENE-2634
> >>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
> >>             Project: Lucene - Java
> >>          Issue Type: Bug
> >>    Affects Versions: 2.9.3
> >>         Environment: Ubuntu 9.10
> >> Sun-java-jdk 1.6.0_20-b02
> >>            Reporter: Nikolay Zamosenchuk
> >>
> >>
> >> Usecase is as following:
> >>
> >> 1. Get indexReader via indexWriter.
> >> 2. Delete documents by Term via indexWriter.
> >> 3. Commit indexWriter.
> >> 4. indexReader.isCurrent() returns true.
> >>
> >> Usually there is a check if index reader is current. If not then it is
> >> reopened (re-obtained via writer or ect.). But this causes the problem
> when
> >> documents can still be found through the search after deletion.
> >> Testcase is attached.
> >>
> >> --
> >> 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-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: dev-help@lucene.apache.org
> >>
> >>
> >
> > I'd expect this behavior if you haven't re-opened your underlying
> > readers after the commit. No index changes are visible after
> > a reader has been opened.
> > Your steps to reproduce do not show any reopen, what happens
> > when you do?
> > Best
> > Erick
> >
> > On Wed, Sep 8, 2010 at 3:54 AM, Nikolay Zamosenchuk (JIRA) <
> jira@apache.org> wrote:
> >>
> >> IndexReader.isCurrent() lies if documents were only removed by latest
> commit
> >>
> ----------------------------------------------------------------------------
> >>
> >>                 Key: LUCENE-2634
> >>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
> >>             Project: Lucene - Java
> >>          Issue Type: Bug
> >>    Affects Versions: 2.9.3
> >>         Environment: Ubuntu 9.10
> >> Sun-java-jdk 1.6.0_20-b02
> >>            Reporter: Nikolay Zamosenchuk
> >>
> >>
> >> Usecase is as following:
> >>
> >> 1. Get indexReader via indexWriter.
> >> 2. Delete documents by Term via indexWriter.
> >> 3. Commit indexWriter.
> >> 4. indexReader.isCurrent() returns true.
> >>
> >> Usually there is a check if index reader is current. If not then it is
> reopened (re-obtained via writer or ect.). But this causes the problem when
> documents can still be found through the search after deletion.
> >> Testcase is attached.
> >>
> >> --
> >> 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-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: dev-help@lucene.apache.org
> >>
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Re: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by Michael McCandless <lu...@mikemccandless.com>.
Actually, IR.isCurrent() is supposed to return false if any changes
have been committed to the index since the IR was opened.

Mike

On Wed, Sep 8, 2010 at 8:11 AM, Erick Erickson <er...@gmail.com> wrote:
> I'd expect this behavior if you haven't re-opened your underlying
> readers after the commit. No index changes are visible after
> a reader has been opened.
>
> Your steps to reproduce do not show any reopen, what happens
> when you do?
>
> Best
> Erick
>
> On Wed, Sep 8, 2010 at 3:54 AM, Nikolay Zamosenchuk (JIRA)
> <ji...@apache.org>wrote:
>
>> IndexReader.isCurrent() lies if documents were only removed by latest
>> commit
>>
>> ----------------------------------------------------------------------------
>>
>>                 Key: LUCENE-2634
>>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>>             Project: Lucene - Java
>>          Issue Type: Bug
>>    Affects Versions: 2.9.3
>>         Environment: Ubuntu 9.10
>> Sun-java-jdk 1.6.0_20-b02
>>            Reporter: Nikolay Zamosenchuk
>>
>>
>> Usecase is as following:
>>
>> 1. Get indexReader via indexWriter.
>> 2. Delete documents by Term via indexWriter.
>> 3. Commit indexWriter.
>> 4. indexReader.isCurrent() returns true.
>>
>> Usually there is a check if index reader is current. If not then it is
>> reopened (re-obtained via writer or ect.). But this causes the problem when
>> documents can still be found through the search after deletion.
>> Testcase is attached.
>>
>> --
>> 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-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>>
>
> I'd expect this behavior if you haven't re-opened your underlying
> readers after the commit. No index changes are visible after
> a reader has been opened.
> Your steps to reproduce do not show any reopen, what happens
> when you do?
> Best
> Erick
>
> On Wed, Sep 8, 2010 at 3:54 AM, Nikolay Zamosenchuk (JIRA) <ji...@apache.org> wrote:
>>
>> IndexReader.isCurrent() lies if documents were only removed by latest commit
>> ----------------------------------------------------------------------------
>>
>>                 Key: LUCENE-2634
>>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>>             Project: Lucene - Java
>>          Issue Type: Bug
>>    Affects Versions: 2.9.3
>>         Environment: Ubuntu 9.10
>> Sun-java-jdk 1.6.0_20-b02
>>            Reporter: Nikolay Zamosenchuk
>>
>>
>> Usecase is as following:
>>
>> 1. Get indexReader via indexWriter.
>> 2. Delete documents by Term via indexWriter.
>> 3. Commit indexWriter.
>> 4. indexReader.isCurrent() returns true.
>>
>> Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
>> Testcase is attached.
>>
>> --
>> 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-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-2634.
----------------------------------------

    Fix Version/s: 2.9.4
                   3.0.3
                   3.1
                   4.0
       Resolution: Fixed

> IndexReader.isCurrent() lies if documents were only removed by latest commit
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-2634
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9.3
>         Environment: Ubuntu 9.10
> Sun-java-jdk 1.6.0_20-b02
>            Reporter: Nikolay Zamosenchuk
>            Assignee: Michael McCandless
>             Fix For: 2.9.4, 3.0.3, 3.1, 4.0
>
>         Attachments: LUCENE-2634.patch, TestIsCurrent.java
>
>
> Usecase is as following:
> 1. Get indexReader via indexWriter.
> 2. Delete documents by Term via indexWriter. 
> 3. Commit indexWriter.
> 4. indexReader.isCurrent() returns true.
> Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
> Testcase is attached.

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


[jira] Commented: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by "Nikolay Zamosenchuk (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907233#action_12907233 ] 

Nikolay Zamosenchuk commented on LUCENE-2634:
---------------------------------------------

Thanks for quick reaction and response!

> IndexReader.isCurrent() lies if documents were only removed by latest commit
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-2634
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9.3
>         Environment: Ubuntu 9.10
> Sun-java-jdk 1.6.0_20-b02
>            Reporter: Nikolay Zamosenchuk
>            Assignee: Michael McCandless
>             Fix For: 2.9.4, 3.0.3, 3.1, 4.0
>
>         Attachments: LUCENE-2634.patch, TestIsCurrent.java
>
>
> Usecase is as following:
> 1. Get indexReader via indexWriter.
> 2. Delete documents by Term via indexWriter. 
> 3. Commit indexWriter.
> 4. indexReader.isCurrent() returns true.
> Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
> Testcase is attached.

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


[jira] Updated: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-2634:
---------------------------------------

    Attachment: LUCENE-2634.patch

Nice catch -- thanks Nikolay!

I attached a patch, including tweaked test case (added copyright, removed @author, cutover to random) and fix.

In the NRT case we were failing to check whether a commit had occurred since the NRT reader was opened.

> IndexReader.isCurrent() lies if documents were only removed by latest commit
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-2634
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9.3
>         Environment: Ubuntu 9.10
> Sun-java-jdk 1.6.0_20-b02
>            Reporter: Nikolay Zamosenchuk
>            Assignee: Michael McCandless
>         Attachments: LUCENE-2634.patch, TestIsCurrent.java
>
>
> Usecase is as following:
> 1. Get indexReader via indexWriter.
> 2. Delete documents by Term via indexWriter. 
> 3. Commit indexWriter.
> 4. indexReader.isCurrent() returns true.
> Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
> Testcase is attached.

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


[jira] Assigned: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reassigned LUCENE-2634:
------------------------------------------

    Assignee: Michael McCandless

> IndexReader.isCurrent() lies if documents were only removed by latest commit
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-2634
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9.3
>         Environment: Ubuntu 9.10
> Sun-java-jdk 1.6.0_20-b02
>            Reporter: Nikolay Zamosenchuk
>            Assignee: Michael McCandless
>         Attachments: TestIsCurrent.java
>
>
> Usecase is as following:
> 1. Get indexReader via indexWriter.
> 2. Delete documents by Term via indexWriter. 
> 3. Commit indexWriter.
> 4. indexReader.isCurrent() returns true.
> Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
> Testcase is attached.

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


[jira] Updated: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by "Nikolay Zamosenchuk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2634?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolay Zamosenchuk updated LUCENE-2634:
----------------------------------------

    Attachment: TestIsCurrent.java

> IndexReader.isCurrent() lies if documents were only removed by latest commit
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-2634
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9.3
>         Environment: Ubuntu 9.10
> Sun-java-jdk 1.6.0_20-b02
>            Reporter: Nikolay Zamosenchuk
>         Attachments: TestIsCurrent.java
>
>
> Usecase is as following:
> 1. Get indexReader via indexWriter.
> 2. Delete documents by Term via indexWriter. 
> 3. Commit indexWriter.
> 4. indexReader.isCurrent() returns true.
> Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
> Testcase is attached.

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


[jira] Commented: (LUCENE-2634) IndexReader.isCurrent() lies if documents were only removed by latest commit

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907234#action_12907234 ] 

Michael McCandless commented on LUCENE-2634:
--------------------------------------------

Thank you for discovering & raising the bug!  That's the hardest part ;)

> IndexReader.isCurrent() lies if documents were only removed by latest commit
> ----------------------------------------------------------------------------
>
>                 Key: LUCENE-2634
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2634
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 2.9.3
>         Environment: Ubuntu 9.10
> Sun-java-jdk 1.6.0_20-b02
>            Reporter: Nikolay Zamosenchuk
>            Assignee: Michael McCandless
>             Fix For: 2.9.4, 3.0.3, 3.1, 4.0
>
>         Attachments: LUCENE-2634.patch, TestIsCurrent.java
>
>
> Usecase is as following:
> 1. Get indexReader via indexWriter.
> 2. Delete documents by Term via indexWriter. 
> 3. Commit indexWriter.
> 4. indexReader.isCurrent() returns true.
> Usually there is a check if index reader is current. If not then it is reopened (re-obtained via writer or ect.). But this causes the problem when documents can still be found through the search after deletion.
> Testcase is attached.

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