mirror of https://github.com/apache/lucene.git
LUCENE-8437: CheckIndex shouldn't duplicate SegmentInfos' serialization logic.
This commit is contained in:
parent
99dbe93681
commit
5dffff7df7
|
@ -171,6 +171,9 @@ API Changes:
|
|||
been changed from a protected method to a java.util.function.Supplier as a
|
||||
constructor argument. (Adrien Grand)
|
||||
|
||||
* LUCENE-8437: CheckIndex.Status.cantOpenSegments and missingSegmentVersion
|
||||
have been removed as they were not computed correctly. (Adrien Grand)
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
* LUCENE-8380: UTF8TaxonomyWriterCache inconsistency. (Ruslan Torobaev, Dawid Weiss)
|
||||
|
|
|
@ -54,7 +54,6 @@ import org.apache.lucene.store.AlreadyClosedException;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.FSDirectory;
|
||||
import org.apache.lucene.store.IOContext;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.store.Lock;
|
||||
import org.apache.lucene.util.Accountables;
|
||||
import org.apache.lucene.util.Bits;
|
||||
|
@ -107,12 +106,6 @@ public final class CheckIndex implements Closeable {
|
|||
/** True if we were unable to locate and load the segments_N file. */
|
||||
public boolean missingSegments;
|
||||
|
||||
/** True if we were unable to open the segments_N file. */
|
||||
public boolean cantOpenSegments;
|
||||
|
||||
/** True if we were unable to read the version number from segments_N file. */
|
||||
public boolean missingSegmentVersion;
|
||||
|
||||
/** Name of latest segments_N file in the index. */
|
||||
public String segmentsFileName;
|
||||
|
||||
|
@ -573,38 +566,6 @@ public final class CheckIndex implements Closeable {
|
|||
|
||||
final int numSegments = sis.size();
|
||||
final String segmentsFileName = sis.getSegmentsFileName();
|
||||
// note: we only read the format byte (required preamble) here!
|
||||
IndexInput input = null;
|
||||
try {
|
||||
input = dir.openInput(segmentsFileName, IOContext.READONCE);
|
||||
} catch (Throwable t) {
|
||||
if (failFast) {
|
||||
throw IOUtils.rethrowAlways(t);
|
||||
}
|
||||
msg(infoStream, "ERROR: could not open segments file in directory");
|
||||
if (infoStream != null) {
|
||||
t.printStackTrace(infoStream);
|
||||
}
|
||||
result.cantOpenSegments = true;
|
||||
return result;
|
||||
}
|
||||
try {
|
||||
/*int format =*/ input.readInt();
|
||||
} catch (Throwable t) {
|
||||
if (failFast) {
|
||||
throw IOUtils.rethrowAlways(t);
|
||||
}
|
||||
msg(infoStream, "ERROR: could not read segment file version in directory");
|
||||
if (infoStream != null) {
|
||||
t.printStackTrace(infoStream);
|
||||
}
|
||||
result.missingSegmentVersion = true;
|
||||
return result;
|
||||
} finally {
|
||||
if (input != null)
|
||||
input.close();
|
||||
}
|
||||
|
||||
result.segmentsFileName = segmentsFileName;
|
||||
result.numSegments = numSegments;
|
||||
result.userData = sis.getUserData();
|
||||
|
|
Loading…
Reference in New Issue