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 2024/02/20 21:11:10 UTC

(lucene) branch branch_9_10 updated (cb2c09d5ce6 -> d689ac96a56)

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

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


    from cb2c09d5ce6 Add next bugfix version 9.10.1
     new 28b04c2cfff Fix addBackcompatIndexes.py to properly generate missing versions (#13095)
     new f2369cc5a2c Only track released versions in `oldVersions`. (#13096)
     new d689ac96a56 Add back-compat indices for 9.10.0

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 dev-tools/scripts/addBackcompatIndexes.py          |  82 +++----
 dev-tools/scripts/scriptutil.py                    |   4 +-
 .../BackwardsCompatibilityTestBase.java            |  91 ++++++--
 .../TestAncientIndicesCompatibility.java           | 259 ++++-----------------
 .../TestBasicBackwardsCompatibility.java           |   2 -
 .../lucene/backward_index/index.9.10.0-cfs.zip     | Bin 0 -> 17198 bytes
 .../lucene/backward_index/index.9.10.0-nocfs.zip   | Bin 0 -> 17182 bytes
 .../apache/lucene/backward_index/sorted.9.10.0.zip | Bin 0 -> 136937 bytes
 .../lucene/backward_index/unsupported_indices.txt  |   4 +
 .../lucene/backward_index/unsupported_versions.txt |  96 ++++++++
 .../org/apache/lucene/backward_index/versions.txt  |  42 ++++
 11 files changed, 291 insertions(+), 289 deletions(-)
 create mode 100644 lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-cfs.zip
 create mode 100644 lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-nocfs.zip
 create mode 100644 lucene/backward-codecs/src/test/org/apache/lucene/backward_index/sorted.9.10.0.zip
 create mode 100644 lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_indices.txt
 create mode 100644 lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_versions.txt
 create mode 100644 lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt


(lucene) 02/03: Only track released versions in `oldVersions`. (#13096)

Posted by jp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f2369cc5a2cf895417e8e04f87e2efd3f4f919f1
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Tue Feb 13 10:48:30 2024 +0100

    Only track released versions in `oldVersions`. (#13096)
---
 .../BackwardsCompatibilityTestBase.java            | 52 ++++++++++++++++++----
 1 file changed, 44 insertions(+), 8 deletions(-)

diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java
index 252c1f3e9ff..fe8919e0a6c 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java
@@ -29,6 +29,7 @@ import java.nio.file.Paths;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Locale;
@@ -85,8 +86,8 @@ public abstract class BackwardsCompatibilityTestBase extends LuceneTestCase {
         throw new RuntimeException(ex);
       }
     }
-    List<Version> allCurrentVersions = getAllCurrentVersions();
-    for (Version version : allCurrentVersions) {
+
+    for (Version version : getAllCurrentReleasedVersions()) {
       // make sure we never miss a version.
       assertTrue("Version: " + version + " missing", binaryVersions.remove(version));
     }
@@ -191,19 +192,54 @@ public abstract class BackwardsCompatibilityTestBase extends LuceneTestCase {
     return versions;
   }
 
+  private static List<Version> getAllCurrentReleasedVersions() {
+    List<Version> currentReleasedVersions = getAllCurrentVersions();
+
+    // The latest version from the current major is always under development.
+    assertTrue(currentReleasedVersions.remove(Version.LATEST));
+    if (Version.LATEST.minor == 0 && Version.LATEST.bugfix == 0) {
+      // If the current branch points to the next major, then the latest minor from the previous
+      // major is also under development.
+      assertTrue(currentReleasedVersions.remove(LATEST_PREVIOUS_MAJOR));
+    }
+
+    // In addition to those, we may need to remove one more version in case a release is in
+    // progress, and the version constant has been added but backward-compatibility indexes have not
+    // been checked in yet.
+    List<Version> missingVersions = new ArrayList<>();
+    for (Iterator<Version> it = currentReleasedVersions.iterator(); it.hasNext(); ) {
+      Version version = it.next();
+      String indexName = String.format(Locale.ROOT, "index.%s-cfs.zip", version);
+      if (TestAncientIndicesCompatibility.class.getResource(indexName) == null) {
+        missingVersions.add(version);
+        it.remove();
+      }
+    }
+
+    if (missingVersions.size() > 1) {
+      throw new AssertionError(
+          "More than one version is missing backward-compatibility data: " + missingVersions);
+    }
+    return currentReleasedVersions;
+  }
+
+  /** Get all versions that are released, plus the latest version which is unreleased. */
+  public static List<Version> getAllCurrentReleasedVersionsAndCurrent() {
+    List<Version> versions = new ArrayList<>(getAllCurrentReleasedVersions());
+    versions.add(Version.LATEST);
+    return versions;
+  }
+
   public static Iterable<Object[]> allVersion(String name, String... suffixes) {
     List<Object> patterns = new ArrayList<>();
     for (String suffix : suffixes) {
       patterns.add(createPattern(name, suffix));
     }
     List<Object[]> versionAndPatterns = new ArrayList<>();
-    List<Version> versionList = getAllCurrentVersions();
+    List<Version> versionList = getAllCurrentReleasedVersionsAndCurrent();
     for (Version v : versionList) {
-      if (v.equals(LATEST_PREVIOUS_MAJOR)
-          == false) { // the latest prev-major has not yet been released
-        for (Object p : patterns) {
-          versionAndPatterns.add(new Object[] {v, p});
-        }
+      for (Object p : patterns) {
+        versionAndPatterns.add(new Object[] {v, p});
       }
     }
     return versionAndPatterns;


(lucene) 01/03: Fix addBackcompatIndexes.py to properly generate missing versions (#13095)

Posted by jp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 28b04c2cfffa69147831ca2af1cfb7eadd0fdef2
Author: Simon Willnauer <si...@apache.org>
AuthorDate: Wed Feb 14 21:43:17 2024 +0100

    Fix addBackcompatIndexes.py to properly generate missing versions (#13095)
    
    In #13046 several changes broke the addBackcompatIndexes.py script
    to properly add and test the unreleased version. This updates the
    script to again properly add the new version.
    
    Closes #13094
    
    Co-authored-by: Dawid Weiss <da...@carrotsearch.com>
---
 dev-tools/scripts/addBackcompatIndexes.py          |  82 +++----
 dev-tools/scripts/scriptutil.py                    |   4 +-
 .../BackwardsCompatibilityTestBase.java            |  39 ++--
 .../TestAncientIndicesCompatibility.java           | 259 ++++-----------------
 .../TestBasicBackwardsCompatibility.java           |   2 -
 .../lucene/backward_index/unsupported_indices.txt  |   4 +
 .../lucene/backward_index/unsupported_versions.txt |  96 ++++++++
 .../org/apache/lucene/backward_index/versions.txt  |  41 ++++
 8 files changed, 246 insertions(+), 281 deletions(-)

diff --git a/dev-tools/scripts/addBackcompatIndexes.py b/dev-tools/scripts/addBackcompatIndexes.py
index 0be87ff7a55..bbaf0b40630 100755
--- a/dev-tools/scripts/addBackcompatIndexes.py
+++ b/dev-tools/scripts/addBackcompatIndexes.py
@@ -96,16 +96,15 @@ def create_and_add_index(source, indextype, index_version, current_version, temp
   scriptutil.run('rm -rf %s' % bc_index_dir)
   print('done')
 
-def update_backcompat_tests(types, index_version, current_version):
-  print('  adding new indexes %s to backcompat tests...' % types, end='', flush=True)
+def update_backcompat_tests(index_version, current_version):
+  print('  adding new indexes to backcompat tests...', end='', flush=True)
   module = 'lucene/backward-codecs'
-  filename = '%s/src/test/org/apache/lucene/backward_index/TestGenerateBwcIndices.java' % module
+
+  filename = None
   if not current_version.is_back_compat_with(index_version):
-    matcher = re.compile(r'final String\[\] unsupportedNames = {|};')
-  elif 'sorted' in types:
-    matcher = re.compile(r'static final String\[\] oldSortedNames = {|};')
+    filename = '%s/src/test/org/apache/lucene/backward_index/unsupported_versions.txt' % module
   else:
-    matcher = re.compile(r'static final String\[\] oldNames = {|};')
+    filename = '%s/src/test/org/apache/lucene/backward_index/versions.txt' % module
 
   strip_dash_suffix_re = re.compile(r'-.*')
 
@@ -114,53 +113,25 @@ def update_backcompat_tests(types, index_version, current_version):
     x = re.sub(strip_dash_suffix_re, '', x) # remove the -suffix if any
     return scriptutil.Version.parse(x)
 
-  class Edit(object):
-    start = None
-    def __call__(self, buffer, match, line):
-      if self.start:
-        # find where this version should exist
-        i = len(buffer) - 1
-        previous_version_exists = not ('};' in line and buffer[-1].strip().endswith("{"))
-        if previous_version_exists: # Only look if there is a version here
-          v = find_version(buffer[i])
-          while i >= self.start and v.on_or_after(index_version):
-            i -= 1
-            v = find_version(buffer[i])
-        i += 1 # readjust since we skipped past by 1
-
-        # unfortunately python doesn't have a range remove from list...
-        # here we want to remove any previous references to the version we are adding
-        while i < len(buffer) and index_version.on_or_after(find_version(buffer[i])):
-          buffer.pop(i)
-
-        if i == len(buffer) and previous_version_exists and not buffer[-1].strip().endswith(","):
-          # add comma
-          buffer[-1] = buffer[-1].rstrip() + ",\n" 
-
-        if previous_version_exists:
-          last = buffer[-1]
-          spaces = ' ' * (len(last) - len(last.lstrip()))
-        else:
-          spaces = '    '
-        for (j, t) in enumerate(types):
-          if t == 'sorted':
-            newline = spaces + ('"sorted.%s"') % index_version
-          else:
-            newline = spaces + ('"%s-%s"' % (index_version, t))
-          if j < len(types) - 1 or i < len(buffer):
-            newline += ','
-          buffer.insert(i, newline + '\n')
-          i += 1
-
-        buffer.append(line)
-        return True
-
-      if 'Names = {' in line:
-        self.start = len(buffer) # location of first index name
-      buffer.append(line)
-      return False
+  def edit(buffer, match, line):
+    v = find_version(line)
+    changed = False
+    if v.on_or_after(index_version):
+       if not index_version.on_or_after(v):
+         buffer.append(('%s\n') % index_version)
+       changed = True
+    buffer.append(line)
+    return changed
+
+  def append(buffer, changed):
+    if changed:
+      return changed
+    if not buffer[len(buffer)-1].endswith('\n'):
+      buffer.append('\n')
+    buffer.append(('%s\n') % index_version)
+    return True
         
-  changed = scriptutil.update_file(filename, matcher, Edit())
+  changed = scriptutil.update_file(filename, re.compile(r'.*'), edit, append)
   print('done' if changed else 'uptodate')
 
 def check_backcompat_tests():
@@ -251,9 +222,8 @@ def main():
     print ('\nMANUAL UPDATE REQUIRED: edit TestGenerateBwcIndices to enable moreterms, dvupdates, and empty index testing')
     
   print('\nAdding backwards compatibility tests')
-  update_backcompat_tests(['cfs', 'nocfs'], c.version, current_version)
-  if should_make_sorted:
-    update_backcompat_tests(['sorted'], c.version, current_version)
+  update_backcompat_tests(c.version, current_version)
+
 
   print('\nTesting changes')
   check_backcompat_tests()
diff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.py
index 97992e116f7..e1c9288770a 100644
--- a/dev-tools/scripts/scriptutil.py
+++ b/dev-tools/scripts/scriptutil.py
@@ -88,7 +88,7 @@ def run(cmd, cwd=None):
     raise e
   return output.decode('utf-8') 
 
-def update_file(filename, line_re, edit):
+def update_file(filename, line_re, edit, append=None):
   infile = open(filename, 'r')
   buffer = [] 
   
@@ -102,6 +102,8 @@ def update_file(filename, line_re, edit):
           return False
         continue
     buffer.append(line)
+  if append:
+    changed = append(buffer, changed) # in the case did not change in edit but have an append function
   if not changed:
     raise Exception('Could not find %s in %s' % (line_re, filename))
   with open(filename, 'w') as f:
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java
index eb832888ddd..252c1f3e9ff 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java
@@ -19,19 +19,24 @@ package org.apache.lucene.backward_index;
 import com.carrotsearch.randomizedtesting.annotations.Name;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.LineNumberReader;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Set;
+import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 import org.apache.lucene.codecs.Codec;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.LeafReaderContext;
@@ -47,25 +52,31 @@ import org.junit.Before;
 
 public abstract class BackwardsCompatibilityTestBase extends LuceneTestCase {
 
-  protected final Version version;
+  static final Set<String> OLD_VERSIONS;
+  protected static final Set<Version> BINARY_SUPPORTED_VERSIONS;
+
   private static final Version LATEST_PREVIOUS_MAJOR = getLatestPreviousMajorVersion();
+
+  protected final Version version;
   protected final String indexPattern;
-  protected static final Set<Version> BINARY_SUPPORTED_VERSIONS;
 
   static {
-    String[] oldVersions =
-        new String[] {
-          "8.0.0", "8.0.0", "8.1.0", "8.1.0", "8.1.1", "8.1.1", "8.2.0", "8.2.0", "8.3.0", "8.3.0",
-          "8.3.1", "8.3.1", "8.4.0", "8.4.0", "8.4.1", "8.4.1", "8.5.0", "8.5.0", "8.5.1", "8.5.1",
-          "8.5.2", "8.5.2", "8.6.0", "8.6.0", "8.6.1", "8.6.1", "8.6.2", "8.6.2", "8.6.3", "8.6.3",
-          "8.7.0", "8.7.0", "8.8.0", "8.8.0", "8.8.1", "8.8.1", "8.8.2", "8.8.2", "8.9.0", "8.9.0",
-          "8.10.0", "8.10.0", "8.10.1", "8.10.1", "8.11.0", "8.11.0", "8.11.1", "8.11.1", "8.11.2",
-          "8.11.2", "8.11.3", "8.11.3", "8.12.0", "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"
-        };
-
+    String name = "versions.txt";
+    try (LineNumberReader in =
+        new LineNumberReader(
+            IOUtils.getDecodingReader(
+                IOUtils.requireResourceNonNull(
+                    BackwardsCompatibilityTestBase.class.getResourceAsStream(name), name),
+                StandardCharsets.UTF_8))) {
+      OLD_VERSIONS =
+          in.lines()
+              .filter(Predicate.not(String::isBlank))
+              .collect(Collectors.toCollection(LinkedHashSet::new));
+    } catch (IOException exception) {
+      throw new RuntimeException("failed to load resource", exception);
+    }
     Set<Version> binaryVersions = new HashSet<>();
-    for (String version : oldVersions) {
+    for (String version : OLD_VERSIONS) {
       try {
         Version v = Version.parse(version);
         assertTrue("Unsupported binary version: " + v, v.major >= Version.MIN_SUPPORTED_MAJOR - 1);
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestAncientIndicesCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestAncientIndicesCompatibility.java
index e7b48fee25a..9a0c771df94 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestAncientIndicesCompatibility.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestAncientIndicesCompatibility.java
@@ -21,8 +21,16 @@ import static java.nio.charset.StandardCharsets.UTF_8;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.LineNumberReader;
 import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Path;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import org.apache.lucene.index.CheckIndex;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexFormatTooOldException;
@@ -36,222 +44,57 @@ import org.apache.lucene.tests.analysis.MockAnalyzer;
 import org.apache.lucene.tests.store.BaseDirectoryWrapper;
 import org.apache.lucene.tests.util.LuceneTestCase;
 import org.apache.lucene.tests.util.TestUtil;
+import org.apache.lucene.util.IOUtils;
 
-@SuppressWarnings("deprecation")
 public class TestAncientIndicesCompatibility extends LuceneTestCase {
+  static final Set<String> UNSUPPORTED_INDEXES;
 
-  static final String[] unsupportedNames = {
-    "1.9.0-cfs",
-    "1.9.0-nocfs",
-    "2.0.0-cfs",
-    "2.0.0-nocfs",
-    "2.1.0-cfs",
-    "2.1.0-nocfs",
-    "2.2.0-cfs",
-    "2.2.0-nocfs",
-    "2.3.0-cfs",
-    "2.3.0-nocfs",
-    "2.4.0-cfs",
-    "2.4.0-nocfs",
-    "2.4.1-cfs",
-    "2.4.1-nocfs",
-    "2.9.0-cfs",
-    "2.9.0-nocfs",
-    "2.9.1-cfs",
-    "2.9.1-nocfs",
-    "2.9.2-cfs",
-    "2.9.2-nocfs",
-    "2.9.3-cfs",
-    "2.9.3-nocfs",
-    "2.9.4-cfs",
-    "2.9.4-nocfs",
-    "3.0.0-cfs",
-    "3.0.0-nocfs",
-    "3.0.1-cfs",
-    "3.0.1-nocfs",
-    "3.0.2-cfs",
-    "3.0.2-nocfs",
-    "3.0.3-cfs",
-    "3.0.3-nocfs",
-    "3.1.0-cfs",
-    "3.1.0-nocfs",
-    "3.2.0-cfs",
-    "3.2.0-nocfs",
-    "3.3.0-cfs",
-    "3.3.0-nocfs",
-    "3.4.0-cfs",
-    "3.4.0-nocfs",
-    "3.5.0-cfs",
-    "3.5.0-nocfs",
-    "3.6.0-cfs",
-    "3.6.0-nocfs",
-    "3.6.1-cfs",
-    "3.6.1-nocfs",
-    "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",
-    "4.0.0.2-cfs",
-    "4.0.0.2-nocfs",
-    "4.1.0-cfs",
-    "4.1.0-nocfs",
-    "4.2.0-cfs",
-    "4.2.0-nocfs",
-    "4.2.1-cfs",
-    "4.2.1-nocfs",
-    "4.3.0-cfs",
-    "4.3.0-nocfs",
-    "4.3.1-cfs",
-    "4.3.1-nocfs",
-    "4.4.0-cfs",
-    "4.4.0-nocfs",
-    "4.5.0-cfs",
-    "4.5.0-nocfs",
-    "4.5.1-cfs",
-    "4.5.1-nocfs",
-    "4.6.0-cfs",
-    "4.6.0-nocfs",
-    "4.6.1-cfs",
-    "4.6.1-nocfs",
-    "4.7.0-cfs",
-    "4.7.0-nocfs",
-    "4.7.1-cfs",
-    "4.7.1-nocfs",
-    "4.7.2-cfs",
-    "4.7.2-nocfs",
-    "4.8.0-cfs",
-    "4.8.0-nocfs",
-    "4.8.1-cfs",
-    "4.8.1-nocfs",
-    "4.9.0-cfs",
-    "4.9.0-nocfs",
-    "4.9.1-cfs",
-    "4.9.1-nocfs",
-    "4.10.0-cfs",
-    "4.10.0-nocfs",
-    "4.10.1-cfs",
-    "4.10.1-nocfs",
-    "4.10.2-cfs",
-    "4.10.2-nocfs",
-    "4.10.3-cfs",
-    "4.10.3-nocfs",
-    "4.10.4-cfs",
-    "4.10.4-nocfs",
-    "5x-with-4x-segments-cfs",
-    "5x-with-4x-segments-nocfs",
-    "5.0.0.singlesegment-cfs",
-    "5.0.0.singlesegment-nocfs",
-    "5.0.0-cfs",
-    "5.0.0-nocfs",
-    "5.1.0-cfs",
-    "5.1.0-nocfs",
-    "5.2.0-cfs",
-    "5.2.0-nocfs",
-    "5.2.1-cfs",
-    "5.2.1-nocfs",
-    "5.3.0-cfs",
-    "5.3.0-nocfs",
-    "5.3.1-cfs",
-    "5.3.1-nocfs",
-    "5.3.2-cfs",
-    "5.3.2-nocfs",
-    "5.4.0-cfs",
-    "5.4.0-nocfs",
-    "5.4.1-cfs",
-    "5.4.1-nocfs",
-    "5.5.0-cfs",
-    "5.5.0-nocfs",
-    "5.5.1-cfs",
-    "5.5.1-nocfs",
-    "5.5.2-cfs",
-    "5.5.2-nocfs",
-    "5.5.3-cfs",
-    "5.5.3-nocfs",
-    "5.5.4-cfs",
-    "5.5.4-nocfs",
-    "5.5.5-cfs",
-    "5.5.5-nocfs",
-    "6.0.0-cfs",
-    "6.0.0-nocfs",
-    "6.0.1-cfs",
-    "6.0.1-nocfs",
-    "6.1.0-cfs",
-    "6.1.0-nocfs",
-    "6.2.0-cfs",
-    "6.2.0-nocfs",
-    "6.2.1-cfs",
-    "6.2.1-nocfs",
-    "6.3.0-cfs",
-    "6.3.0-nocfs",
-    "6.4.0-cfs",
-    "6.4.0-nocfs",
-    "6.4.1-cfs",
-    "6.4.1-nocfs",
-    "6.4.2-cfs",
-    "6.4.2-nocfs",
-    "6.5.0-cfs",
-    "6.5.0-nocfs",
-    "6.5.1-cfs",
-    "6.5.1-nocfs",
-    "6.6.0-cfs",
-    "6.6.0-nocfs",
-    "6.6.1-cfs",
-    "6.6.1-nocfs",
-    "6.6.2-cfs",
-    "6.6.2-nocfs",
-    "6.6.3-cfs",
-    "6.6.3-nocfs",
-    "6.6.4-cfs",
-    "6.6.4-nocfs",
-    "6.6.5-cfs",
-    "6.6.5-nocfs",
-    "6.6.6-cfs",
-    "6.6.6-nocfs",
-    "7.0.0-cfs",
-    "7.0.0-nocfs",
-    "7.0.1-cfs",
-    "7.0.1-nocfs",
-    "7.1.0-cfs",
-    "7.1.0-nocfs",
-    "7.2.0-cfs",
-    "7.2.0-nocfs",
-    "7.2.1-cfs",
-    "7.2.1-nocfs",
-    "7.3.0-cfs",
-    "7.3.0-nocfs",
-    "7.3.1-cfs",
-    "7.3.1-nocfs",
-    "7.4.0-cfs",
-    "7.4.0-nocfs",
-    "7.5.0-cfs",
-    "7.5.0-nocfs",
-    "7.6.0-cfs",
-    "7.6.0-nocfs",
-    "7.7.0-cfs",
-    "7.7.0-nocfs",
-    "7.7.1-cfs",
-    "7.7.1-nocfs",
-    "7.7.2-cfs",
-    "7.7.2-nocfs",
-    "7.7.3-cfs",
-    "7.7.3-nocfs"
-  };
+  static {
+    String name = "unsupported_versions.txt";
+    Set<String> indices;
+    try (LineNumberReader in =
+        new LineNumberReader(
+            IOUtils.getDecodingReader(
+                IOUtils.requireResourceNonNull(
+                    TestAncientIndicesCompatibility.class.getResourceAsStream(name), name),
+                StandardCharsets.UTF_8))) {
+      indices =
+          in.lines()
+              .filter(Predicate.not(String::isBlank))
+              .flatMap(version -> Stream.of(version + "-cfs", version + "-nocfs"))
+              .collect(Collectors.toCollection(LinkedHashSet::new));
+    } catch (IOException exception) {
+      throw new RuntimeException("failed to load resource", exception);
+    }
+
+    name = "unsupported_indices.txt";
+    try (LineNumberReader in =
+        new LineNumberReader(
+            IOUtils.getDecodingReader(
+                IOUtils.requireResourceNonNull(
+                    TestAncientIndicesCompatibility.class.getResourceAsStream(name), name),
+                StandardCharsets.UTF_8))) {
+      indices.addAll(
+          in.lines()
+              .filter(Predicate.not(String::isBlank))
+              .collect(Collectors.toCollection(LinkedHashSet::new)));
+    } catch (IOException exception) {
+      throw new RuntimeException("failed to load resource", exception);
+    }
+    UNSUPPORTED_INDEXES = Collections.unmodifiableSet(indices);
+  }
 
   /**
    * This test checks that *only* IndexFormatTooOldExceptions are thrown when you open and operate
    * on too old indexes!
    */
   public void testUnsupportedOldIndexes() throws Exception {
-    for (int i = 0; i < unsupportedNames.length; i++) {
+    for (String version : UNSUPPORTED_INDEXES) {
       if (VERBOSE) {
-        System.out.println("TEST: index " + unsupportedNames[i]);
+        System.out.println("TEST: index " + version);
       }
-      Path oldIndexDir = createTempDir(unsupportedNames[i]);
-      TestUtil.unzip(
-          getDataInputStream("unsupported." + unsupportedNames[i] + ".zip"), oldIndexDir);
+      Path oldIndexDir = createTempDir(version);
+      TestUtil.unzip(getDataInputStream("unsupported." + version + ".zip"), oldIndexDir);
       BaseDirectoryWrapper dir = newFSDirectory(oldIndexDir);
       // don't checkindex, these are intentionally not supported
       dir.setCheckIndexOnClose(false);
@@ -260,7 +103,7 @@ public class TestAncientIndicesCompatibility extends LuceneTestCase {
       IndexWriter writer = null;
       try {
         reader = DirectoryReader.open(dir);
-        fail("DirectoryReader.open should not pass for " + unsupportedNames[i]);
+        fail("DirectoryReader.open should not pass for " + version);
       } catch (IndexFormatTooOldException e) {
         if (e.getReason() != null) {
           assertNull(e.getVersion());
@@ -300,7 +143,7 @@ public class TestAncientIndicesCompatibility extends LuceneTestCase {
         writer =
             new IndexWriter(
                 dir, newIndexWriterConfig(new MockAnalyzer(random())).setCommitOnClose(false));
-        fail("IndexWriter creation should not pass for " + unsupportedNames[i]);
+        fail("IndexWriter creation should not pass for " + version);
       } catch (IndexFormatTooOldException e) {
         if (e.getReason() != null) {
           assertNull(e.getVersion());
@@ -353,7 +196,7 @@ public class TestAncientIndicesCompatibility extends LuceneTestCase {
       CheckIndex checker = new CheckIndex(dir);
       checker.setInfoStream(new PrintStream(bos, false, UTF_8));
       CheckIndex.Status indexStatus = checker.checkIndex();
-      if (unsupportedNames[i].startsWith("7.")) {
+      if (version.startsWith("7.")) {
         assertTrue(indexStatus.clean);
       } else {
         assertFalse(indexStatus.clean);
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBasicBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBasicBackwardsCompatibility.java
index 2805de744cc..1217c064c0e 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBasicBackwardsCompatibility.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBasicBackwardsCompatibility.java
@@ -101,8 +101,6 @@ public class TestBasicBackwardsCompatibility extends BackwardsCompatibilityTestB
       KnnFloatVectorField.createFieldType(3, VectorSimilarityFunction.COSINE);
   private static final float[] KNN_VECTOR = {0.2f, -0.1f, 0.1f};
 
-  static final int MIN_BINARY_SUPPORTED_MAJOR = Version.MIN_SUPPORTED_MAJOR - 1;
-
   /**
    * A parameter constructor for {@link com.carrotsearch.randomizedtesting.RandomizedRunner}. See
    * {@link #testVersionsFactory()} for details on the values provided to the framework.
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_indices.txt b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_indices.txt
new file mode 100644
index 00000000000..3d2a5ace2e8
--- /dev/null
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_indices.txt
@@ -0,0 +1,4 @@
+5x-with-4x-segments-cfs
+5x-with-4x-segments-nocfs
+5.0.0.singlesegment-cfs
+5.0.0.singlesegment-nocfs
\ No newline at end of file
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_versions.txt b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_versions.txt
new file mode 100644
index 00000000000..c342a8e3019
--- /dev/null
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/unsupported_versions.txt
@@ -0,0 +1,96 @@
+1.9.0
+2.0.0
+2.1.0
+2.2.0
+2.3.0
+2.4.0
+2.4.1
+2.9.0
+2.9.1
+2.9.2
+2.9.3
+2.9.4
+3.0.0
+3.0.1
+3.0.2
+3.0.3
+3.1.0
+3.2.0
+3.3.0
+3.4.0
+3.5.0
+3.6.0
+3.6.1
+3.6.2
+4.0.0
+4.0.0.1
+4.0.0.2
+4.1.0
+4.2.0
+4.2.1
+4.3.0
+4.3.1
+4.4.0
+4.5.0
+4.5.1
+4.6.0
+4.6.1
+4.7.0
+4.7.1
+4.7.2
+4.8.0
+4.8.1
+4.9.0
+4.9.1
+4.10.0
+4.10.1
+4.10.2
+4.10.3
+4.10.4
+5.0.0
+5.1.0
+5.2.0
+5.2.1
+5.3.0
+5.3.1
+5.3.2
+5.4.0
+5.4.1
+5.5.0
+5.5.1
+5.5.2
+5.5.3
+5.5.4
+5.5.5
+6.0.0
+6.0.1
+6.1.0
+6.2.0
+6.2.1
+6.3.0
+6.4.0
+6.4.1
+6.4.2
+6.5.0
+6.5.1
+6.6.0
+6.6.1
+6.6.2
+6.6.3
+6.6.4
+6.6.5
+6.6.6
+7.0.0
+7.0.1
+7.1.0
+7.2.0
+7.2.1
+7.3.0
+7.3.1
+7.4.0
+7.5.0
+7.6.0
+7.7.0
+7.7.1
+7.7.2
+7.7.3
\ No newline at end of file
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt
new file mode 100644
index 00000000000..e3733db2465
--- /dev/null
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt
@@ -0,0 +1,41 @@
+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.12.0
+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
\ No newline at end of file


(lucene) 03/03: Add back-compat indices for 9.10.0

Posted by jp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d689ac96a565ca469a3e26103c2cc1e066ef5758
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Tue Feb 20 22:07:27 2024 +0100

    Add back-compat indices for 9.10.0
---
 .../apache/lucene/backward_index/index.9.10.0-cfs.zip  | Bin 0 -> 17198 bytes
 .../lucene/backward_index/index.9.10.0-nocfs.zip       | Bin 0 -> 17182 bytes
 .../org/apache/lucene/backward_index/sorted.9.10.0.zip | Bin 0 -> 136937 bytes
 .../test/org/apache/lucene/backward_index/versions.txt |   3 ++-
 4 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-cfs.zip
new file mode 100644
index 00000000000..433aef0c8c6
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-cfs.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-nocfs.zip
new file mode 100644
index 00000000000..6da00722761
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/index.9.10.0-nocfs.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/sorted.9.10.0.zip b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/sorted.9.10.0.zip
new file mode 100644
index 00000000000..131d82c5acf
Binary files /dev/null and b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/sorted.9.10.0.zip differ
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt
index e3733db2465..ea09b7a6bf7 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/versions.txt
@@ -38,4 +38,5 @@
 9.8.0
 9.9.0
 9.9.1
-9.9.2
\ No newline at end of file
+9.9.2
+9.10.0