Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 e463259f9d..7123e7040a 100644
- --- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
- +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
- @@ -127,7 +127,9 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
- /** 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;
- - static final int VERSION_CURRENT = VERSION_70;
- + public static final int VERSION_80 = 8;
- +
- + static final int VERSION_CURRENT = VERSION_80;
- /** Used to name new segments. */
- // TODO: should this be a long ...?
- @@ -165,13 +167,13 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
- private final int indexCreatedVersionMajor;
- /** Sole constructor.
- - * @param indexCreatedVersionMajor the Lucene version major at index creation time, or 6 if the index was created before 7.0 */
- + * @param indexCreatedVersionMajor the Lucene version major at index creation time, or 7 if the index was created before 8.0 */
- public SegmentInfos(int indexCreatedVersionMajor) {
- if (indexCreatedVersionMajor > Version.LATEST.major) {
- throw new IllegalArgumentException("indexCreatedVersionMajor is in the future: " + indexCreatedVersionMajor);
- }
- - if (indexCreatedVersionMajor < 6) {
- - throw new IllegalArgumentException("indexCreatedVersionMajor must be >= 6, got: " + indexCreatedVersionMajor);
- + if (indexCreatedVersionMajor < 7) {
- + throw new IllegalArgumentException("indexCreatedVersionMajor must be >= 7, got: " + indexCreatedVersionMajor);
- }
- this.indexCreatedVersionMajor = indexCreatedVersionMajor;
- }
- @@ -312,12 +314,12 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
- CodecUtil.checkIndexHeaderSuffix(input, Long.toString(generation, Character.MAX_RADIX));
- Version luceneVersion = Version.fromBits(input.readVInt(), input.readVInt(), input.readVInt());
- - if (luceneVersion.onOrAfter(Version.LUCENE_6_0_0) == false) {
- + if (luceneVersion.onOrAfter(Version.LUCENE_7_0_0) == false) {
- // TODO: should we check indexCreatedVersion instead?
- throw new IndexFormatTooOldException(input, "this index is too old (version: " + luceneVersion + ")");
- }
- - int indexCreatedVersion = 6;
- + int indexCreatedVersion = 7;
- if (format >= VERSION_70) {
- indexCreatedVersion = input.readVInt();
- }
- diff --git a/lucene/core/src/test/org/apache/lucene/index/TestSegmentInfos.java b/lucene/core/src/test/org/apache/lucene/index/TestSegmentInfos.java
- index 128601e4e1..5576bc9fcd 100644
- --- a/lucene/core/src/test/org/apache/lucene/index/TestSegmentInfos.java
- +++ b/lucene/core/src/test/org/apache/lucene/index/TestSegmentInfos.java
- @@ -30,9 +30,9 @@ import java.util.Collections;
- public class TestSegmentInfos extends LuceneTestCase {
- public void testIllegalCreatedVersion() {
- - IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new SegmentInfos(5));
- - assertEquals("indexCreatedVersionMajor must be >= 6, got: 5", e.getMessage());
- - e = expectThrows(IllegalArgumentException.class, () -> new SegmentInfos(8));
- + IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new SegmentInfos(6));
- + assertEquals("indexCreatedVersionMajor must be >= 7, got: 6", e.getMessage());
- + e = expectThrows(IllegalArgumentException.class, () -> new SegmentInfos(9));
- assertEquals("indexCreatedVersionMajor is in the future: 8", e.getMessage());
- }
- @@ -56,7 +56,7 @@ public class TestSegmentInfos extends LuceneTestCase {
- Codec codec = Codec.getDefault();
- SegmentInfos sis = new SegmentInfos(Version.LATEST.major);
- - SegmentInfo info = new SegmentInfo(dir, Version.LUCENE_7_0_0, Version.LUCENE_7_0_0, "_0", 1, false, Codec.getDefault(),
- + SegmentInfo info = new SegmentInfo(dir, Version.LUCENE_8_0_0, Version.LUCENE_8_0_0, "_0", 1, false, Codec.getDefault(),
- Collections.<String,String>emptyMap(), id, Collections.<String,String>emptyMap(), null);
- info.setFiles(Collections.<String>emptySet());
- codec.segmentInfoFormat().write(dir, info, IOContext.DEFAULT);
- @@ -65,7 +65,7 @@ public class TestSegmentInfos extends LuceneTestCase {
- sis.add(commitInfo);
- sis.commit(dir);
- sis = SegmentInfos.readLatestCommit(dir);
- - assertEquals(Version.LUCENE_7_0_0, sis.getMinSegmentLuceneVersion());
- + assertEquals(Version.LUCENE_8_0_0, sis.getMinSegmentLuceneVersion());
- assertEquals(Version.LATEST, sis.getCommitLuceneVersion());
- dir.close();
- }
- @@ -78,14 +78,14 @@ public class TestSegmentInfos extends LuceneTestCase {
- Codec codec = Codec.getDefault();
- SegmentInfos sis = new SegmentInfos(Version.LATEST.major);
- - SegmentInfo info = new SegmentInfo(dir, Version.LUCENE_7_0_0, Version.LUCENE_7_0_0, "_0", 1, false, Codec.getDefault(),
- + SegmentInfo info = new SegmentInfo(dir, Version.LUCENE_8_0_0, Version.LUCENE_8_0_0, "_0", 1, false, Codec.getDefault(),
- Collections.<String,String>emptyMap(), id, Collections.<String,String>emptyMap(), null);
- info.setFiles(Collections.<String>emptySet());
- codec.segmentInfoFormat().write(dir, info, IOContext.DEFAULT);
- SegmentCommitInfo commitInfo = new SegmentCommitInfo(info, 0, -1, -1, -1);
- sis.add(commitInfo);
- - info = new SegmentInfo(dir, Version.LUCENE_7_0_0, Version.LUCENE_7_0_0, "_1", 1, false, Codec.getDefault(),
- + info = new SegmentInfo(dir, Version.LUCENE_8_0_0, Version.LUCENE_8_0_0, "_1", 1, false, Codec.getDefault(),
- Collections.<String,String>emptyMap(), id, Collections.<String,String>emptyMap(), null);
- info.setFiles(Collections.<String>emptySet());
- codec.segmentInfoFormat().write(dir, info, IOContext.DEFAULT);
- @@ -94,7 +94,7 @@ public class TestSegmentInfos extends LuceneTestCase {
- sis.commit(dir);
- sis = SegmentInfos.readLatestCommit(dir);
- - assertEquals(Version.LUCENE_7_0_0, sis.getMinSegmentLuceneVersion());
- + assertEquals(Version.LUCENE_8_0_0, sis.getMinSegmentLuceneVersion());
- assertEquals(Version.LATEST, sis.getCommitLuceneVersion());
- dir.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment