diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
index e3761ccc2f6..a00a470a249 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
@@ -65,7 +65,7 @@ import org.apache.lucene.util.Version;
* Files:
*
* - segments_N: Header, LuceneVersion, Version, NameCounter, SegCount, MinSegmentLuceneVersion, <SegName,
- * HasSegID, SegID, SegCodec, DelGen, DeletionCount, FieldInfosGen, DocValuesGen,
+ * SegID, SegCodec, DelGen, DeletionCount, FieldInfosGen, DocValuesGen,
* UpdatesFiles>SegCount, CommitUserData, Footer
*
* Data types:
@@ -78,7 +78,6 @@ import org.apache.lucene.util.Version;
* {@link DataOutput#writeInt Int32}
* Generation, Version, DelGen, Checksum, FieldInfosGen, DocValuesGen -->
* {@link DataOutput#writeLong Int64}
- * HasSegID --> {@link DataOutput#writeByte Int8}
* SegID --> {@link DataOutput#writeByte Int8ID_LENGTH}
* SegName, SegCodec --> {@link DataOutput#writeString String}
* CommitUserData --> {@link DataOutput#writeMapOfStrings
@@ -100,9 +99,6 @@ import org.apache.lucene.util.Version;
* DeletionCount records the number of deleted documents in this segment.
* SegCodec is the {@link Codec#getName() name} of the Codec that encoded
* this segment.
- * HasSegID is nonzero if the segment has an identifier. Otherwise, when it is 0
- * the identifier is {@code null} and no SegID is written. Null only happens for Lucene
- * 4.x segments referenced in commits.
* SegID is the identifier of the Codec that encoded this segment.
* CommitUserData stores an optional user-supplied opaque
* Map<String,String> that was passed to
@@ -345,17 +341,17 @@ public final class SegmentInfos implements Cloneable, Iterable unsupportedCodecs = Arrays.asList(
- "Lucene3x", "Lucene40", "Lucene41", "Lucene42", "Lucene45", "Lucene46", "Lucene49", "Lucene410"
- );
-
- private static Codec readCodec(DataInput input, boolean unsupportedAllowed) throws IOException {
+ private static Codec readCodec(DataInput input) throws IOException {
final String name = input.readString();
try {
return Codec.forName(name);
} catch (IllegalArgumentException e) {
- // give better error messages if we can, first check if this is a legacy codec
- if (unsupportedCodecs.contains(name)) {
- // We should only get here on pre-5.3 indices, but we can't test this until 7.0 when 5.x indices become too old:
- assert unsupportedAllowed;
- IOException newExc = new IndexFormatTooOldException(input, "Codec '" + name + "' is too old");
- newExc.initCause(e);
- throw newExc;
- }
- // or maybe it's an old default codec that moved
+ // maybe it's an old default codec that moved
if (name.startsWith("Lucene")) {
throw new IllegalArgumentException("Could not load codec '" + name + "'. Did you forget to add lucene-backward-codecs.jar?", e);
}
@@ -523,16 +507,10 @@ public final class SegmentInfos implements Cloneable, Iterable