diff --git a/docs/changelog/125666.yaml b/docs/changelog/125666.yaml new file mode 100644 index 0000000000000..bf629dde23a40 --- /dev/null +++ b/docs/changelog/125666.yaml @@ -0,0 +1,5 @@ +pr: 125666 +summary: Minor-Fixes Support 7x segments as archive in 8x / 9x +area: Search +type: bug +issues: [] diff --git a/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/BWCCodec.java b/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/BWCCodec.java index f12935a2bec08..8e0f87eb3d00b 100644 --- a/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/BWCCodec.java +++ b/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/BWCCodec.java @@ -29,7 +29,6 @@ import org.apache.lucene.store.IOContext; import org.apache.lucene.util.Version; import org.elasticsearch.core.UpdateForV10; -import org.elasticsearch.xpack.lucene.bwc.codecs.lucene70.BWCLucene70Codec; import org.elasticsearch.xpack.lucene.bwc.codecs.lucene80.BWCLucene80Codec; import org.elasticsearch.xpack.lucene.bwc.codecs.lucene84.BWCLucene84Codec; import org.elasticsearch.xpack.lucene.bwc.codecs.lucene86.BWCLucene86Codec; @@ -229,7 +228,6 @@ private static Codec getBackwardCompatibleCodec(Codec codec) { if (codec == null) return null; return switch (codec.getClass().getSimpleName()) { - case "Lucene70Codec" -> new BWCLucene70Codec(); case "Lucene80Codec" -> new BWCLucene80Codec(); case "Lucene84Codec" -> new BWCLucene84Codec(); case "Lucene86Codec" -> new BWCLucene86Codec(); diff --git a/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene60/MetadataOnlyBKDReader.java b/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene60/MetadataOnlyBKDReader.java index ab865cba8722e..b50ca32dd88ad 100644 --- a/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene60/MetadataOnlyBKDReader.java +++ b/x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene60/MetadataOnlyBKDReader.java @@ -86,8 +86,16 @@ public MetadataOnlyBKDReader(IndexInput metaIn, boolean isVersionPost86) throws pointCount = metaIn.readVLong(); docCount = metaIn.readVInt(); - // This code has been introduced to process IndexInput created with Lucene86Codec+. This is not necessary - // in the read-only version for older formats. + // The pre-8.6 code does not read the following fields that its standard Lucene counterpart does. After experimenting with the + // code, we got to the conclusion that these are the last fields being read, which are not needed in the metadata-only reader, and + // we can safely ignore them when loading the file. Although by coincidence, nothing breaks if we read a couple of VLongs, as long + // as some bytes are available to read. + // + // The extra reads have been introduced to process IndexInput created with Lucene86Codec+, where a new BKD format has been + // introduced. We have stricter checks around the header and footer starting from the 86 formats hence we do need to + // consume all the data input there but not in previous formats. + // + // For correctness, we added version checking here. If and only if, the version is 8.6 or higher, we read the additional fields. if (isVersionPost86) { metaIn.readVInt(); metaIn.readLong();