mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
[CORE] Don't handle FNF exceptions when reading snapshot
We used to handle FNF exceptions in the store when reading a snapshot. For instance if we can't open a segments file for a given commit point we just return an empty metadata object and tracelog the even. This can cause shards to be false marked as corrupted if a shard is forcefully removed while a recovery started at the same time. We should in general bubble up these exceptions and let the caller decided how to handle the IOExceptions.
This commit is contained in:
parent
a8b21f2cd5
commit
40945aebcf
@ -384,7 +384,7 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex
|
||||
}
|
||||
|
||||
/**
|
||||
* This exists so {@link BloomFilteringPostingsFormat} can load its boolean setting; can we find a more straightforward way?
|
||||
* This exists so {@link org.elasticsearch.index.codec.postingsformat.BloomFilterPostingsFormat} can load its boolean setting; can we find a more straightforward way?
|
||||
*/
|
||||
public class StoreDirectory extends FilterDirectory {
|
||||
|
||||
@ -471,14 +471,7 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex
|
||||
ImmutableMap.Builder<String, StoreFileMetaData> builder = ImmutableMap.builder();
|
||||
Map<String, String> checksumMap = readLegacyChecksums(directory);
|
||||
try {
|
||||
final SegmentInfos segmentCommitInfos;
|
||||
try {
|
||||
segmentCommitInfos = Store.readSegmentsInfo(commit, directory);
|
||||
} catch (FileNotFoundException | NoSuchFileException ex) {
|
||||
// no segments file -- can't read metadata
|
||||
logger.trace("Can't read segment infos", ex);
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
final SegmentInfos segmentCommitInfos = Store.readSegmentsInfo(commit, directory);
|
||||
Version maxVersion = Version.LUCENE_3_0; // we don't know which version was used to write so we take the max version.
|
||||
for (SegmentCommitInfo info : segmentCommitInfos) {
|
||||
final Version version = info.info.getVersion();
|
||||
|
Loading…
x
Reference in New Issue
Block a user