msokolov commented on PR #15431:
URL: https://github.com/apache/lucene/pull/15431#issuecomment-3564226378

   I think what happened is that we are now able to read some more of the 
back-compat indexes that we previously said were incompatible. But this doesn't 
really make sense since the 10x branch does not include any additional 
backwards codecs that were removed from main.
   
   
   
   I was able to get tests passing by relaxing a few version numbers and by I 
changing the exception type when we are unable to read the segments file from 
IllegalArgumentException to IndexFormatTooOldException to match the 
expectations of the test. Maybe that was bad, but it seems pretty harmless to 
me? I'm not sure if this change is safe or not.
   
   ```
   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 a06a96b2ed5..56608b0b506 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
   @@ -199,7 +199,7 @@ public class TestAncientIndicesCompatibility extends 
LuceneTestCase {
          checker.setInfoStream(new PrintStream(bos, false, UTF_8));
          checker.setLevel(CheckIndex.Level.MIN_LEVEL_FOR_INTEGRITY_CHECKS);
          CheckIndex.Status indexStatus = checker.checkIndex();
   -      if (getVersion(version).onOrAfter(Version.fromBits(8, 6, 0))) {
   +      if (getVersion(version).onOrAfter(Version.fromBits(8, 0, 0))) {
            assertTrue(indexStatus.clean);
          } else {
            assertFalse(indexStatus.clean);
   @@ -209,10 +209,9 @@ public class TestAncientIndicesCompatibility extends 
LuceneTestCase {
            boolean formatTooOld =
                
bos.toString(UTF_8).contains(IndexFormatTooOldException.class.getName());
            boolean missingCodec = bos.toString(UTF_8).contains("Could not load 
codec");
   -        assertTrue(formatTooOld || missingCodec);
   +        assertTrue("version=" + version, formatTooOld || missingCodec);
          }
          checker.close();
   -
          dir.close();
        }
      }
   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 131518983a8..621ecb0b529 100644
   --- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
   +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
   @@ -328,7 +328,7 @@ public final class SegmentInfos implements Cloneable, 
Iterable<SegmentCommitInfo
            throw new IndexFormatTooOldException(
                input, magic, CodecUtil.CODEC_MAGIC, CodecUtil.CODEC_MAGIC);
          }
   -      format = CodecUtil.checkHeaderNoMagic(input, "segments", VERSION_86, 
VERSION_CURRENT);
   +      format = CodecUtil.checkHeaderNoMagic(input, "segments", VERSION_74, 
VERSION_CURRENT);
          byte[] id = new byte[StringHelper.ID_LENGTH];
          input.readBytes(id, 0, id.length);
          CodecUtil.checkIndexHeaderSuffix(input, Long.toString(generation, 
Character.MAX_RADIX));
   @@ -529,11 +529,13 @@ public final class SegmentInfos implements Cloneable, 
Iterable<SegmentCommitInfo
        } catch (IllegalArgumentException e) {
          // maybe it's an old default codec that moved
          if (name.startsWith("Lucene")) {
   -        throw new IllegalArgumentException(
   +        throw new IndexFormatTooOldException(
   +            input,
                "Could not load codec '"
                    + name
   -                + "'. Did you forget to add lucene-backward-codecs.jar?",
   -            e);
   +                + "'. "
   +                + e.getMessage()
   +                + " Did you forget to add lucene-backward-codecs.jar?");
          }
          throw e;
        }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to