mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-04 09:59:16 +00:00
[STORE] Treat reading past EOF as an corrupted index when we fail to read segment infos
This commit is contained in:
parent
81e86eba6e
commit
0a988ad8f7
@ -45,10 +45,7 @@ import org.elasticsearch.index.shard.ShardId;
|
|||||||
import org.elasticsearch.index.store.distributor.Distributor;
|
import org.elasticsearch.index.store.distributor.Distributor;
|
||||||
import org.elasticsearch.index.store.support.ForceSyncDirectory;
|
import org.elasticsearch.index.store.support.ForceSyncDirectory;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.*;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@ -396,6 +393,9 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex
|
|||||||
// no segments file -- can't read metadata
|
// no segments file -- can't read metadata
|
||||||
logger.trace("Can't read segment infos", ex);
|
logger.trace("Can't read segment infos", ex);
|
||||||
return ImmutableMap.of();
|
return ImmutableMap.of();
|
||||||
|
} 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);
|
||||||
}
|
}
|
||||||
Version maxVersion = Version.LUCENE_3_0; // we don't know which version was used to write so we take the max version.
|
Version maxVersion = Version.LUCENE_3_0; // we don't know which version was used to write so we take the max version.
|
||||||
Set<String> added = new HashSet<>();
|
Set<String> added = new HashSet<>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user