You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2021/12/08 12:45:50 UTC

[lucene] branch branch_9_0 updated: Add back-compat indices for 9.0.0

This is an automated email from the ASF dual-hosted git repository.

jpountz pushed a commit to branch branch_9_0
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9_0 by this push:
     new 3aadc5c  Add back-compat indices for 9.0.0
3aadc5c is described below

commit 3aadc5cd89b3bf3b491968f6990ce597455a108f
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Wed Dec 8 13:42:40 2021 +0100

    Add back-compat indices for 9.0.0
---
 .../backward_index/TestBackwardsCompatibility.java |  42 +++++++++++++--------
 .../lucene/backward_index/dvupdates.9.0.0.zip      | Bin 0 -> 14471 bytes
 .../apache/lucene/backward_index/empty.9.0.0.zip   | Bin 0 -> 376 bytes
 .../lucene/backward_index/index.9.0.0-cfs.zip      | Bin 0 -> 16674 bytes
 .../lucene/backward_index/index.9.0.0-nocfs.zip    | Bin 0 -> 16665 bytes
 .../lucene/backward_index/moreterms.9.0.0.zip      | Bin 0 -> 141561 bytes
 .../apache/lucene/backward_index/sorted.9.0.0.zip  | Bin 0 -> 132016 bytes
 7 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java
index 2962293..bb10d1b 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java
@@ -378,7 +378,9 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
     "8.10.1-cfs",
     "8.10.1-nocfs",
     "8.11.0-cfs",
-    "8.11.0-nocfs"
+    "8.11.0-nocfs",
+    "9.0.0-cfs",
+    "9.0.0-nocfs"
   };
 
   public static String[] getOldNames() {
@@ -408,7 +410,8 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
     "sorted.8.8.2",
     "sorted.8.9.0",
     "sorted.8.10.1",
-    "sorted.8.11.0"
+    "sorted.8.11.0",
+    "sorted.9.0.0"
   };
 
   public static String[] getOldSortedNames() {
@@ -1768,7 +1771,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
     }
   }
 
-  public static final String emptyIndex = "empty.8.0.0.zip";
+  public static final String emptyIndex = "empty.9.0.0.zip";
 
   public void testUpgradeEmptyOldIndex() throws Exception {
     Path oldIndexDir = createTempDir("emptyIndex");
@@ -1777,12 +1780,12 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
 
     newIndexUpgrader(dir).upgrade();
 
-    checkAllSegmentsUpgraded(dir, 8);
+    checkAllSegmentsUpgraded(dir, 9);
 
     dir.close();
   }
 
-  public static final String moreTermsIndex = "moreterms.8.0.0.zip";
+  public static final String moreTermsIndex = "moreterms.9.0.0.zip";
 
   public void testMoreTerms() throws Exception {
     Path oldIndexDir = createTempDir("moreterms");
@@ -1798,7 +1801,7 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
     dir.close();
   }
 
-  public static final String dvUpdatesIndex = "dvupdates.8.0.0.zip";
+  public static final String dvUpdatesIndex = "dvupdates.9.0.0.zip";
 
   private void assertNumericDocValues(LeafReader r, String f, String cf) throws IOException {
     NumericDocValues ndvf = r.getNumericDocValues(f);
@@ -2083,16 +2086,23 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
     for (String name : oldNames) {
       Directory directory = oldIndexDirs.get(name);
       IndexCommit commit = DirectoryReader.listCommits(directory).get(0);
-      IndexFormatTooOldException ex =
-          expectThrows(
-              IndexFormatTooOldException.class,
-              () -> StandardDirectoryReader.open(commit, Version.LATEST.major, null));
-      assertTrue(
-          ex.getMessage()
-              .contains(
-                  "only supports reading from version " + Version.LATEST.major + " upwards."));
-      // now open with allowed min version
-      StandardDirectoryReader.open(commit, Version.MIN_SUPPORTED_MAJOR, null).close();
+
+      final int createdMajor;
+      // No exception when opening with the allowed min version
+      try (IndexReader reader = StandardDirectoryReader.open(commit, Version.MIN_SUPPORTED_MAJOR, null)) {
+        createdMajor = reader.leaves().get(0).reader().getMetaData().getCreatedVersionMajor();
+      }
+
+      if (createdMajor < Version.LATEST.major) {
+        IndexFormatTooOldException ex =
+            expectThrows(
+                IndexFormatTooOldException.class,
+                () -> StandardDirectoryReader.open(commit, Version.LATEST.major, null));
+        assertTrue(
+            ex.getMessage()
+                .contains(
+                    "only supports reading from version " + Version.LATEST.major + " upwards."));
+      }
     }
   }
 
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/dvupdates.9.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/dvupdates.9.0.0.zip
new file mode 100644
index 0000000..1416538
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/dvupdates.9.0.0.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/empty.9.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/empty.9.0.0.zip
new file mode 100644
index 0000000..f898ef2
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/empty.9.0.0.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-cfs.zip
new file mode 100644
index 0000000..cc0a072
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-cfs.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-nocfs.zip
new file mode 100644
index 0000000..160cba2
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.0.0-nocfs.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/moreterms.9.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/moreterms.9.0.0.zip
new file mode 100644
index 0000000..c83401f
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/moreterms.9.0.0.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/sorted.9.0.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/sorted.9.0.0.zip
new file mode 100644
index 0000000..d70dac0
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/sorted.9.0.0.zip differ