[STORE] Turn unexpected exception into CorruptedIndexException
Today if we run into exception like NumberFormatException or IAE when we try to open a commit point to retrieve checksums and calculate store metadata we just bubble them up. Yet, those are very likely index corruptions. In such a case we should really mark the shard as corrupted.
This commit is contained in:
parent
9b5497f6ca
commit
a0e9951e8a
|
@ -125,7 +125,12 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex
|
||||||
} catch (EOFException eof) {
|
} catch (EOFException eof) {
|
||||||
// TODO this should be caught by lucene - EOF is almost certainly an index corruption
|
// TODO this should be caught by lucene - EOF is almost certainly an index corruption
|
||||||
throw new CorruptIndexException("Read past EOF while reading segment infos", eof);
|
throw new CorruptIndexException("Read past EOF while reading segment infos", eof);
|
||||||
|
} catch (IOException exception) {
|
||||||
|
throw exception; // IOExceptions like too many open files are not necessarily a corruption - just bubble it up
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new CorruptIndexException("Hit unexpected exception while reading segment infos", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final void ensureOpen() { // for testing
|
final void ensureOpen() { // for testing
|
||||||
|
|
Loading…
Reference in New Issue