Skip to content

Corruption detection is fragile? #24800

@jpountz

Description

@jpountz

I was looking at how we detect corruptions, and the current logic tries to see whether the exception itself or any of its causes is an instance of CorruptIndexException. However, the following pattern that Lucene uses in multiple places:

Throwable priorE = null;
try (ChecksumIndexInput input = dir.openChecksumInput(fileName, context)) {
  // do some stuff that may throw any exceptions
} catch (Throwable exception) {
  priorE = exception;
} finally {
  CodecUtil.checkFooter(input, priorE);
}

causes the CorruptIndexException to be suppressed if some other exception was thrown in the try block. So the thrown exception would not be seen as a corruption exception. This makes me want to check for suppressed exceptions as well in ExceptionsHelper.unwrapCorruption but I don't know enough about corruption detection to know whether that is safe to do?

Metadata

Metadata

Labels

:Distributed Indexing/StoreIssues around managing unopened Lucene indices. If it touches Store.java, this is a likely label.>enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions