[jira] [Created] (LUCENE-3899) Evil up MockDirectoryWrapper.checkIndexOnClose

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (LUCENE-3899) Evil up MockDirectoryWrapper.checkIndexOnClose

JIRA jira@apache.org
Evil up MockDirectoryWrapper.checkIndexOnClose
----------------------------------------------

                 Key: LUCENE-3899
                 URL: https://issues.apache.org/jira/browse/LUCENE-3899
             Project: Lucene - Java
          Issue Type: Test
            Reporter: Robert Muir
             Fix For: 3.6, 4.0
         Attachments: LUCENE-3899.patch

MockDirectoryWrapper checks any indexes tests create on close(), if they exist.

The problem is the logic it uses to determine if an index exists could mask real bugs (e.g. segments file corrumption):
{code}
if (DirectoryReader.indexExists(this) {
  ...
  // evil stuff like crash()
  ...
  _TestUtil.checkIndex(this)
}
{code}

and for reference DirectoryReader.indexExists is:
{code}
try {
  new SegmentInfos().read(directory);
  return true;
} catch (IOException ioe) {
  return false;
}
{code}

So if there are segments file problems, we just silently do no checkIndex.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (LUCENE-3899) Evil up MockDirectoryWrapper.checkIndexOnClose

JIRA jira@apache.org

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

Robert Muir updated LUCENE-3899:
--------------------------------

    Attachment: LUCENE-3899.patch

attached is a patch:

I had to disable checkIndexOnClose for TestBackwardsCompatibility.testUnsupportedOldIndexes (because we intentionally don't want to checkIndex() them, it will now fail).

I think its ready to commit.
               

> Evil up MockDirectoryWrapper.checkIndexOnClose
> ----------------------------------------------
>
>                 Key: LUCENE-3899
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3899
>             Project: Lucene - Java
>          Issue Type: Test
>            Reporter: Robert Muir
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3899.patch
>
>
> MockDirectoryWrapper checks any indexes tests create on close(), if they exist.
> The problem is the logic it uses to determine if an index exists could mask real bugs (e.g. segments file corrumption):
> {code}
> if (DirectoryReader.indexExists(this) {
>   ...
>   // evil stuff like crash()
>   ...
>   _TestUtil.checkIndex(this)
> }
> {code}
> and for reference DirectoryReader.indexExists is:
> {code}
> try {
>   new SegmentInfos().read(directory);
>   return true;
> } catch (IOException ioe) {
>   return false;
> }
> {code}
> So if there are segments file problems, we just silently do no checkIndex.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (LUCENE-3899) Evil up MockDirectoryWrapper.checkIndexOnClose

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Michael McCandless commented on LUCENE-3899:
--------------------------------------------

+1

More evilness!
               

> Evil up MockDirectoryWrapper.checkIndexOnClose
> ----------------------------------------------
>
>                 Key: LUCENE-3899
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3899
>             Project: Lucene - Java
>          Issue Type: Test
>            Reporter: Robert Muir
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3899.patch
>
>
> MockDirectoryWrapper checks any indexes tests create on close(), if they exist.
> The problem is the logic it uses to determine if an index exists could mask real bugs (e.g. segments file corrumption):
> {code}
> if (DirectoryReader.indexExists(this) {
>   ...
>   // evil stuff like crash()
>   ...
>   _TestUtil.checkIndex(this)
> }
> {code}
> and for reference DirectoryReader.indexExists is:
> {code}
> try {
>   new SegmentInfos().read(directory);
>   return true;
> } catch (IOException ioe) {
>   return false;
> }
> {code}
> So if there are segments file problems, we just silently do no checkIndex.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (LUCENE-3899) Evil up MockDirectoryWrapper.checkIndexOnClose

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

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

Robert Muir resolved LUCENE-3899.
---------------------------------

    Resolution: Fixed
   

> Evil up MockDirectoryWrapper.checkIndexOnClose
> ----------------------------------------------
>
>                 Key: LUCENE-3899
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3899
>             Project: Lucene - Java
>          Issue Type: Test
>            Reporter: Robert Muir
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3899.patch
>
>
> MockDirectoryWrapper checks any indexes tests create on close(), if they exist.
> The problem is the logic it uses to determine if an index exists could mask real bugs (e.g. segments file corrumption):
> {code}
> if (DirectoryReader.indexExists(this) {
>   ...
>   // evil stuff like crash()
>   ...
>   _TestUtil.checkIndex(this)
> }
> {code}
> and for reference DirectoryReader.indexExists is:
> {code}
> try {
>   new SegmentInfos().read(directory);
>   return true;
> } catch (IOException ioe) {
>   return false;
> }
> {code}
> So if there are segments file problems, we just silently do no checkIndex.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]