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


##########
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:
   Hmm this is tricky. As such, we are able to read the SegmentInfos file and 
extract the indexCreatedVersionMajor which is how it was done  previously. 
However if we base our decision on it, it would defeat the purpose of this PR. 
   
   The idea is that if the reindexing is done in a way as described in my talk 
and also in the discussion on this PR, then we could end up in a scenario where 
indexCreatedVersionMajor is pretty old, but all segments have still been 
reindexed with supported codec. And we should be able to open such an index.
   
   I agree that the best course of action might be to retain the existing 
behavior of throwing IllegalArgumentException outlining the two possibilities 
for failure (backward-codecs-jar not being present or index is too old). Unless 
I can think of anything better, I guess I will just change 
TestAncientIndicesCompatibility instead.



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