You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/07/07 04:24:31 UTC
[19/28] lucene-solr:feature/autoscaling: Remove unnecessary backward
compatibility from SegmentInfos.
Remove unnecessary backward compatibility from SegmentInfos.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/77ee4ddb
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/77ee4ddb
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/77ee4ddb
Branch: refs/heads/feature/autoscaling
Commit: 77ee4ddb9956dd45d6c55a38fd97bf4a3bea0c15
Parents: a60ec1b
Author: Adrien Grand <jp...@gmail.com>
Authored: Wed Jul 5 09:47:28 2017 +0200
Committer: Adrien Grand <jp...@gmail.com>
Committed: Thu Jul 6 16:22:40 2017 +0200
----------------------------------------------------------------------
.../java/org/apache/lucene/index/SegmentInfos.java | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/77ee4ddb/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
----------------------------------------------------------------------
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 a00a470..9f1450b 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
@@ -118,8 +118,6 @@ import org.apache.lucene.util.Version;
*/
public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo> {
- /** Adds the {@link Version} that committed this segments_N file, as well as the {@link Version} of the oldest segment, since 5.3+ */
- public static final int VERSION_53 = 6;
/** The version that added information about the Lucene version at the time when the index has been created. */
public static final int VERSION_70 = 7;
@@ -302,7 +300,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
if (magic != CodecUtil.CODEC_MAGIC) {
throw new IndexFormatTooOldException(input, magic, CodecUtil.CODEC_MAGIC, CodecUtil.CODEC_MAGIC);
}
- int format = CodecUtil.checkHeaderNoMagic(input, "segments", VERSION_53, VERSION_CURRENT);
+ int format = CodecUtil.checkHeaderNoMagic(input, "segments", VERSION_70, VERSION_CURRENT);
byte id[] = new byte[StringHelper.ID_LENGTH];
input.readBytes(id, 0, id.length);
CodecUtil.checkIndexHeaderSuffix(input, Long.toString(generation, Character.MAX_RADIX));
@@ -313,10 +311,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
throw new IndexFormatTooOldException(input, "this index is too old (version: " + luceneVersion + ")");
}
- int indexCreatedVersion = 6;
- if (format >= VERSION_70) {
- indexCreatedVersion = input.readVInt();
- }
+ int indexCreatedVersion = input.readVInt();
SegmentInfos infos = new SegmentInfos(indexCreatedVersion);
infos.id = id;
@@ -341,14 +336,6 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
long totalDocs = 0;
for (int seg = 0; seg < numSegments; seg++) {
String segName = input.readString();
- if (format < VERSION_70) {
- byte hasID = input.readByte();
- if (hasID == 0) {
- throw new IndexFormatTooOldException(input, "Segment is from Lucene 4.x");
- } else if (hasID != 1) {
- throw new CorruptIndexException("invalid hasID byte, got: " + hasID, input);
- }
- }
byte[] segmentID = new byte[StringHelper.ID_LENGTH];
input.readBytes(segmentID, 0, segmentID.length);
Codec codec = readCodec(input);