Skip to content

Commit

Permalink
Lucene:11 Fix backward-compatibility tests and remove 9.x versions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHegarty authored Oct 2, 2024
1 parent bb2d09f commit 19da754
Show file tree
Hide file tree
Showing 75 changed files with 40 additions and 179 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class TestLucene90SegmentInfoFormat extends BaseSegmentInfoFormatTestCase

@Override
protected Version[] getVersions() {
return new Version[] {Version.LUCENE_9_0_0};
return new Version[] {Version.fromBits(9, 0, 0)};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public abstract class BackwardsCompatibilityTestBase extends LuceneTestCase {
*/
protected BackwardsCompatibilityTestBase(
@Name("version") Version version, @Name("pattern") String indexPattern) {
// TODO: add 10.0.0 bw indices after 10.0.0 has been released, see
// https://github.com/apache/lucene/issues/13847
assumeTrue("Can only test with 10.0.0 has been released", version.major < 10);
this.version = version;
this.indexPattern = indexPattern;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void testUnsupportedOldIndexes() throws Exception {
checker.setInfoStream(new PrintStream(bos, false, UTF_8));
checker.setLevel(CheckIndex.Level.MIN_LEVEL_FOR_INTEGRITY_CHECKS);
CheckIndex.Status indexStatus = checker.checkIndex();
if (version.startsWith("8.")) {
if (version.startsWith("8.") || version.startsWith("9.")) {
assertTrue(indexStatus.clean);
} else {
assertFalse(indexStatus.clean);
Expand All @@ -219,10 +219,11 @@ public void testUnsupportedOldIndexes() throws Exception {
// #12895: test on a carefully crafted 9.8.0 index (from a small contiguous subset
// of wikibigall unique terms) that shows the read-time exception of
// IntersectTermsEnum (used by WildcardQuery)
@AwaitsFix(bugUrl = "https://github.com/apache/lucene/issues/13847")
public void testWildcardQueryExceptions990() throws IOException {
Path path = createTempDir("12895");

String name = "index.12895.9.8.0.zip";
String name = "unsupported.12895.9.8.0.zip";
InputStream resource = TestAncientIndicesCompatibility.class.getResourceAsStream(name);
assertNotNull("missing zip file to reproduce #12895", resource);
TestUtil.unzip(resource, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.lucene.backward_index;

import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
import static org.apache.lucene.util.Version.LUCENE_9_0_0;

import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import java.io.IOException;
Expand Down Expand Up @@ -96,7 +95,7 @@ public class TestBasicBackwardsCompatibility extends BackwardsCompatibilityTestB
private static final int DOCS_COUNT = 35;
private static final int DELETED_ID = 7;

private static final int KNN_VECTOR_MIN_SUPPORTED_VERSION = LUCENE_9_0_0.major;
private static final int KNN_VECTOR_MIN_SUPPORTED_VERSION = Version.fromBits(9, 0, 0).major;
private static final String KNN_VECTOR_FIELD = "knn_field";
private static final FieldType KNN_VECTOR_FIELD_TYPE =
KnnFloatVectorField.createFieldType(3, VectorSimilarityFunction.COSINE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public TestDVUpdateBackwardsCompatibility(Version version, String pattern) {
public static Iterable<Object[]> testVersionsFactory() {
List<Object[]> params = new ArrayList<>();
// TODO - WHY ONLY on the first major version?
params.add(new Object[] {Version.LUCENE_9_0_0, createPattern(INDEX_NAME, SUFFIX)});
params.add(new Object[] {Version.LUCENE_10_0_0, createPattern(INDEX_NAME, SUFFIX)});
return params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ protected void createIndex(Directory directory) throws IOException {
public static Iterable<Object[]> testVersionsFactory() {
List<Object[]> params = new ArrayList<>();
// TODO - WHY ONLY on the first major version?
params.add(new Object[] {Version.LUCENE_9_0_0, createPattern(INDEX_NAME, SUFFIX)});
params.add(new Object[] {Version.LUCENE_10_0_0, createPattern(INDEX_NAME, SUFFIX)});
return params;
}

public void testUpgradeEmptyOldIndex() throws Exception {
try (Directory dir = newDirectory(directory)) {
TestIndexUpgradeBackwardsCompatibility.newIndexUpgrader(dir).upgrade();
TestIndexUpgradeBackwardsCompatibility.checkAllSegmentsUpgraded(dir, 9);
TestIndexUpgradeBackwardsCompatibility.checkAllSegmentsUpgraded(dir, 10);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class TestIndexSortBackwardsCompatibility extends BackwardsCompatibilityT

static final String INDEX_NAME = "sorted";
static final String SUFFIX = "";
private static final Version FIRST_PARENT_DOC_VERSION = Version.LUCENE_9_11_0;
private static final Version FIRST_PARENT_DOC_VERSION = Version.fromBits(9, 11, 0);
private static final String PARENT_FIELD_NAME = "___parent";

public TestIndexSortBackwardsCompatibility(Version version, String pattern) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TestInt8HnswBackwardsCompatibility extends BackwardsCompatibilityTe

static final String INDEX_NAME = "int8_hnsw";
static final String SUFFIX = "";
private static final Version FIRST_INT8_HNSW_VERSION = Version.LUCENE_9_10_0;
private static final Version FIRST_INT8_HNSW_VERSION = Version.fromBits(9, 10, 0);
private static final String KNN_VECTOR_FIELD = "knn_field";
private static final int DOC_COUNT = 30;
private static final FieldType KNN_VECTOR_FIELD_TYPE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.tests.analysis.MockAnalyzer;
import org.apache.lucene.tests.util.LineFileDocs;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.lucene.tests.util.TestUtil;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.Version;

@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/apache/lucene/issues/13847")
public class TestMoreTermsBackwardsCompatibility extends BackwardsCompatibilityTestBase {

static final String INDEX_NAME = "moreterms";
static final String INDEX_NAME = "unsupported.moreterms";

static final String SUFFIX = "";

Expand All @@ -48,7 +50,7 @@ public TestMoreTermsBackwardsCompatibility(Version version, String pattern) {
@ParametersFactory(argumentFormatting = "Lucene-Version:%1$s; Pattern: %2$s")
public static Iterable<Object[]> testVersionsFactory() {
List<Object[]> params = new ArrayList<>();
params.add(new Object[] {Version.LUCENE_9_0_0, createPattern(INDEX_NAME, SUFFIX)});
params.add(new Object[] {Version.fromBits(9, 0, 0), createPattern(INDEX_NAME, SUFFIX)});
return params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,22 @@
8.11.1
8.11.2
8.11.3
8.11.4
8.11.4
9.0.0
9.1.0
9.2.0
9.3.0
9.4.0
9.4.1
9.4.2
9.5.0
9.6.0
9.7.0
9.8.0
9.9.0
9.9.1
9.9.2
9.10.0
9.11.0
9.11.1
9.12.0
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
8.0.0
8.1.0
8.1.1
8.2.0
8.3.0
8.3.1
8.4.0
8.4.1
8.5.0
8.5.1
8.5.2
8.6.0
8.6.1
8.6.2
8.6.3
8.7.0
8.8.0
8.8.1
8.8.2
8.9.0
8.10.0
8.10.1
8.11.0
8.11.1
8.11.2
8.11.3
8.11.4
9.0.0
9.1.0
9.2.0
Expand All @@ -43,3 +16,4 @@
9.11.0
9.11.1
9.12.0
10.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
* are in no particular order.
* @param hasBlocks Returns <code>true</code> iff this index contains blocks created with {@link
* IndexWriter#addDocument(Iterable)} or it's corresponding update methods with at least 2 or
* more documents per call. Note: This property was not recorded before {@link
* Version#LUCENE_9_9_0} this method will return false for all leaves written before {@link
* Version#LUCENE_9_9_0}
* more documents per call. Note: This property was not recorded before {@link Version
* LUCENE_9_9_0} this method will return false for all leaves written before {@link Version
* LUCENE_9_9_0}
* @see IndexWriter#updateDocuments(Term, Iterable)
* @see IndexWriter#updateDocuments(Query, Iterable)
* @see IndexWriter#softUpdateDocuments(Term, Iterable, Field...)
Expand Down
136 changes: 0 additions & 136 deletions lucene/core/src/java/org/apache/lucene/util/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,142 +31,6 @@
*/
public final class Version {

/**
* Match settings and bugs in Lucene's 9.0.0 release.
*
* @deprecated (9.1.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_0_0 = new Version(9, 0, 0);

/**
* Match settings and bugs in Lucene's 9.1.0 release.
*
* @deprecated (9.2.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_1_0 = new Version(9, 1, 0);

/**
* Match settings and bugs in Lucene's 9.2.0 release.
*
* @deprecated (9.3.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_2_0 = new Version(9, 2, 0);

/**
* Match settings and bugs in Lucene's 9.3.0 release.
*
* @deprecated (9.4.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_3_0 = new Version(9, 3, 0);

/**
* Match settings and bugs in Lucene's 9.4.0 release.
*
* @deprecated Use latest
*/
@Deprecated public static final Version LUCENE_9_4_0 = new Version(9, 4, 0);

/**
* Match settings and bugs in Lucene's 9.4.1 release.
*
* @deprecated Use latest
* @deprecated (9.4.2) Use latest
*/
@Deprecated public static final Version LUCENE_9_4_1 = new Version(9, 4, 1);

/**
* Match settings and bugs in Lucene's 9.4.2 release.
*
* @deprecated Use latest
*/
@Deprecated public static final Version LUCENE_9_4_2 = new Version(9, 4, 2);

/**
* Match settings and bugs in Lucene's 9.5.0 release.
*
* @deprecated (9.6.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_5_0 = new Version(9, 5, 0);

/**
* Match settings and bugs in Lucene's 9.6.0 release.
*
* @deprecated (9.7.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_6_0 = new Version(9, 6, 0);

/**
* Match settings and bugs in Lucene's 9.7.0 release.
*
* @deprecated (9.8.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_7_0 = new Version(9, 7, 0);

/**
* Match settings and bugs in Lucene's 9.8.0 release.
*
* @deprecated (9.9.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_8_0 = new Version(9, 8, 0);

/**
* Match settings and bugs in Lucene's 9.9.0 release.
*
* @deprecated (9.9.1) Use latest
*/
@Deprecated public static final Version LUCENE_9_9_0 = new Version(9, 9, 0);

/**
* Match settings and bugs in Lucene's 9.9.1 release.
*
* @deprecated (9.9.2) Use latest
*/
@Deprecated public static final Version LUCENE_9_9_1 = new Version(9, 9, 1);

/**
* Match settings and bugs in Lucene's 9.9.2 release.
*
* @deprecated (9.10.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_9_2 = new Version(9, 9, 2);

/**
* Match settings and bugs in Lucene's 9.10.0 release.
*
* @deprecated (9.11.0) Use latest
*/
@Deprecated public static final Version LUCENE_9_10_0 = new Version(9, 10, 0);

/**
* Match settings and bugs in Lucene's 9.11.0 release.
*
* @deprecated Use latest
* @deprecated (9.12.0) Use latest
* @deprecated (9.11.1) Use latest
*/
@Deprecated public static final Version LUCENE_9_11_0 = new Version(9, 11, 0);

/**
* Match settings and bugs in Lucene's 9.11.1 release.
*
* @deprecated Use latest
*/
@Deprecated public static final Version LUCENE_9_11_1 = new Version(9, 11, 1);

/**
* Match settings and bugs in Lucene's 9.12.0 release.
*
* @deprecated Use latest
*/
@Deprecated public static final Version LUCENE_9_12_0 = new Version(9, 12, 0);

/**
* Match settings and bugs in Lucene's 9.13.0 release.
*
* @deprecated Use latest
*/
@Deprecated public static final Version LUCENE_9_13_0 = new Version(9, 13, 0);

/**
* @deprecated Use latest
*/
Expand Down

0 comments on commit 19da754

Please sign in to comment.