[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:
Simon Willnauer 2014-09-11 16:01:04 +02:00
parent 9b5497f6ca
commit a0e9951e8a
1 changed files with 5 additions and 0 deletions

View File

@ -125,7 +125,12 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex
} catch (EOFException eof) {
// 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);
} 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