Skip to content

Catch assertion errors on commit and turn it into a real exception#19357

Merged
s1monw merged 1 commit intoelastic:masterfrom
s1monw:issues/19356
Jul 11, 2016
Merged

Catch assertion errors on commit and turn it into a real exception#19357
s1monw merged 1 commit intoelastic:masterfrom
s1monw:issues/19356

Conversation

@s1monw
Copy link
Copy Markdown
Contributor

@s1monw s1monw commented Jul 11, 2016

Lucene IndexWriter asserts on files existing on the filesystem but
some tests throw IOException explicitly on those operatiosn such that
some tests trip asserts. We had this before on InternalEngine#ctor
and added some logic there to catch only a specific assertions based
on some excepition stack analysis. This change applies the same logic
to the IndexWriter#commit part of the engine since it can hit the same
issue.
This also fixes a self-suppression issue in Store.java.

Closes #19356

Lucene IndexWriter asserts on files existing on the filesystem but
some tests throw IOException explicitly on those operatiosn such that
some tests trip asserts. We had this before on InternalEngine#ctor
and added some logic there to catch only a specific assertions based
on some excepition stack analysis. This change applies the same logic
to the IndexWriter#commit part of the engine since it can hit the same
issue.
This also fixes a self-suppression issue in Store.java.

Closes elastic#19356
@s1monw s1monw added >bug >test Issues or PRs that are addressing/adding tests review :Distributed/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. v5.0.0-alpha5 labels Jul 11, 2016
@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Jul 11, 2016

@mikemccand can you take a look

@mikemccand
Copy link
Copy Markdown
Contributor

LGTM, nice find.

Maybe we should fix IW to throw CorruptIndexException instead of AssertionError? This exact situation has also caused problems for Lucene's tests, and it's crazy that the caller needs to go and unwrap AssertionError and poke around to figure out which exception it was...

@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Jul 11, 2016

++ to upgrade this assertion to a hard check and throw CIE?

@s1monw s1monw merged commit 1d03a14 into elastic:master Jul 11, 2016
@mikemccand
Copy link
Copy Markdown
Contributor

OK I just removed these assertions from IW entirely: apache/lucene-solr@044aabf

Turns out they are not needed anymore because the low level APIs IW is using in Lucene were improved themselves to catch these cases even w/o assertions enabled.

So when we upgrade to Lucene 6.2 we can remove the unwrapping of AssertionError.

@s1monw
Copy link
Copy Markdown
Contributor Author

s1monw commented Jul 11, 2016

AWESOME! thanks mike

@clintongormley clintongormley added :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Distributed/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. >test Issues or PRs that are addressing/adding tests v5.0.0-alpha5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build Failure: org.elasticsearch.search.basic.SearchWithRandomIOExceptionsIT.testRandomDirectoryIOExceptions

3 participants