rahulgoswami commented on code in PR #14607:
URL: https://github.com/apache/lucene/pull/14607#discussion_r2507650610


##########
lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java:
##########
@@ -402,11 +389,38 @@ private static void parseSegmentInfos(
     }
 
     long totalDocs = 0;
+
     for (int seg = 0; seg < numSegments; seg++) {
       String segName = input.readString();
       byte[] segmentID = new byte[StringHelper.ID_LENGTH];
       input.readBytes(segmentID, 0, segmentID.length);
-      Codec codec = readCodec(input);
+      Codec codec = null;
+      try {
+        codec = readCodec(input);

Review Comment:
   Seems like TestAncientIndicesCompatibility.testUnsupportedOldIndexes is 
happy as long as it gets an IndexFormatTooOldException (IFTOE). The test fails 
in the DirectoryReader.open(dir) call with an IllegalArgumentException (which 
is what the latest commit fixes by intercepting and throwing IFTOE instead 
during segment level check).
   
   I observe two things...
   1) the version values for VERSION_74 and VERSION_86 are different from what 
the variable names suggest.
    public static final int VERSION_74 = 9;
   
    public static final int VERSION_86 = 10;
   
   2) CodecUtil.checkHeaderNoMagic(input, "segments", VERSION_74, 
VERSION_CURRENT) should have thrown an IndexFormatTooOldException for the 7.x 
index because of `if (actualVersion < minVersion) ` check. I am not sure yet 
why it didn't . That would have made the test pass. Something in the way the 
test index has been created?



-- 
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