Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/125666.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 125666
summary: Minor-Fixes Support 7x segments as archive in 8x / 9x
area: Search
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 assumption that these are the last fields being read, which are not needed in the metadata-only reader, and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace assumption with conclusion? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ty!

// 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. It seems that we have stricter checks around the header and footer starting from the 86 formats hence we do need to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "it seems"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

// 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();
Expand Down
Loading