Skip to content

Apache Lucene open-source search software

Add 8.0.0 back compat test indexes and reenable backward compatibility tests for 9

jimczi2afa6cb00a29
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
index a7cbdf7b7bb..d208e4c91e0 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
@@ -287,7 +287,8 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
final static String[] oldNames = {
-
+ "8.0.0-cfs",
+ "8.0.0-nocfs"
};
public static String[] getOldNames() {
@@ -295,7 +296,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
final static String[] oldSortedNames = {
-
+ "sorted.8.0.0"
};
public static String[] getOldSortedNames() {
@@ -352,6 +353,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
"3.6.2-cfs",
"3.6.2-nocfs",
"4.0.0-cfs",
+ "4.0.0-cfs",
"4.0.0-nocfs",
"4.0.0.1-cfs",
"4.0.0.1-nocfs",
@@ -819,7 +821,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
Directory targetDir2 = newDirectory();
IndexWriter w = new IndexWriter(targetDir2, newIndexWriterConfig(new MockAnalyzer(random())));
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> TestUtil.addIndexesSlowly(w, reader));
- assertEquals(e.getMessage(), "Cannot merge a segment that has been created with major version 7 into this index which has been created by major version 8");
+ assertEquals(e.getMessage(), "Cannot merge a segment that has been created with major version 8 into this index which has been created by major version 9");
w.close();
targetDir2.close();
@@ -1503,14 +1505,13 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
public static final String emptyIndex = "empty.8.0.0.zip";
public void testUpgradeEmptyOldIndex() throws Exception {
- assumeTrue("Reenable when 8.0 is released", false);
Path oldIndexDir = createTempDir("emptyIndex");
TestUtil.unzip(getDataInputStream(emptyIndex), oldIndexDir);
Directory dir = newFSDirectory(oldIndexDir);
newIndexUpgrader(dir).upgrade();
- checkAllSegmentsUpgraded(dir, 7);
+ checkAllSegmentsUpgraded(dir, 8);
dir.close();
}
@@ -1518,7 +1519,6 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
public static final String moreTermsIndex = "moreterms.8.0.0.zip";
public void testMoreTerms() throws Exception {
- assumeTrue("Reenable when 8.0 is released", false);
Path oldIndexDir = createTempDir("moreterms");
TestUtil.unzip(getDataInputStream(moreTermsIndex), oldIndexDir);
Directory dir = newFSDirectory(oldIndexDir);
@@ -1563,7 +1563,6 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
public void testDocValuesUpdates() throws Exception {
- assumeTrue("Reenable when 8.0 is released", false);
Path oldIndexDir = createTempDir("dvupdates");
TestUtil.unzip(getDataInputStream(dvUpdatesIndex), oldIndexDir);
Directory dir = newFSDirectory(oldIndexDir);
@@ -1592,7 +1591,6 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
public void testSoftDeletes() throws Exception {
- assumeTrue("Reenable when 8.0 is released", false);
Path oldIndexDir = createTempDir("dvupdates");
TestUtil.unzip(getDataInputStream(dvUpdatesIndex), oldIndexDir);
Directory dir = newFSDirectory(oldIndexDir);
@@ -1613,7 +1611,6 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
public void testDocValuesUpdatesWithNewField() throws Exception {
- assumeTrue("Reenable when 8.0 is released", false);
Path oldIndexDir = createTempDir("dvupdates");
TestUtil.unzip(getDataInputStream(dvUpdatesIndex), oldIndexDir);
Directory dir = newFSDirectory(oldIndexDir);
@@ -1722,34 +1719,6 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
}
}
- /**
- * Tests that {@link CheckIndex} can detect invalid sort on sorted indices created
- * before https://issues.apache.org/jira/browse/LUCENE-8592.
- */
- public void testSortedIndexWithInvalidSort() throws Exception {
- assumeTrue("Reenable when 8.0 is released", false);
- Path path = createTempDir("sorted");
- String name = "sorted-invalid.8.0.0.zip";
- InputStream resource = TestBackwardsCompatibility.class.getResourceAsStream(name);
- assertNotNull("Sorted index index " + name + " not found", resource);
- TestUtil.unzip(resource, path);
-
- Directory dir = FSDirectory.open(path);
-
- DirectoryReader reader = DirectoryReader.open(dir);
- assertEquals(1, reader.leaves().size());
- Sort sort = reader.leaves().get(0).reader().getMetaData().getSort();
- assertNotNull(sort);
- assertEquals("<long: \"dateDV\">! missingValue=-9223372036854775808", sort.toString());
- reader.close();
- CheckIndex.Status status = TestUtil.checkIndex(dir);
- assertEquals(1, status.segmentInfos.size());
- assertNotNull(status.segmentInfos.get(0).indexSortStatus.error);
- assertEquals(status.segmentInfos.get(0).indexSortStatus.error.getMessage(),
- "segment has indexSort=<long: \"dateDV\">! missingValue=-9223372036854775808 but docID=4 sorts after docID=5");
- dir.close();
- }
-
static long getValue(BinaryDocValues bdv) throws IOException {
BytesRef term = bdv.binaryValue();
int idx = term.offset;
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/dvupdates.8.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/dvupdates.8.0.0.zip
new file mode 100644
index 00000000000..38c542814b1
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/dvupdates.8.0.0.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/empty.8.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/empty.8.0.0.zip
new file mode 100644
index 00000000000..91a9e92fde9
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/empty.8.0.0.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.8.0.0-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.8.0.0-cfs.zip
new file mode 100644
index 00000000000..c96c1aece3c
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.8.0.0-cfs.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.8.0.0-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.8.0.0-nocfs.zip
new file mode 100644
index 00000000000..b57448628fc
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.8.0.0-nocfs.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/moreterms.8.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/moreterms.8.0.0.zip
new file mode 100644
index 00000000000..82b0f1497fe
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/moreterms.8.0.0.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/sorted.8.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/sorted.8.0.0.zip
new file mode 100644
index 00000000000..8fd974df73f
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/index/sorted.8.0.0.zip differ