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
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ private static Version parseUnchecked(String version) {
public static final IndexVersion LOGSB_OPTIONAL_SORTING_ON_HOST_NAME_BACKPORT = def(8_525_0_00, parseUnchecked("9.12.1"));
public static final IndexVersion USE_SYNTHETIC_SOURCE_FOR_RECOVERY_BY_DEFAULT_BACKPORT = def(8_526_0_00, parseUnchecked("9.12.1"));
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X = def(8_527_0_00, Version.LUCENE_9_12_1);
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER_BACKPORT_8_X = def(8_528_0_00, Version.LUCENE_9_12_1);
public static final IndexVersion SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_BOOLEAN_BACKPORT_8_X = def(8_529_0_00, Version.LUCENE_9_12_1);
Copy link
Member

Choose a reason for hiding this comment

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

I think this version doesn't exist in the 8.x branch?

Thinking more about this, given the 8.19.0 has not been released yet. I think we reuse the SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X index version. Also in 8.x branch, however I see that SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER was added. So In think here we can just use SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER in places where SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_BOOLEAN_BACKPORT_8_X is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I've been backporting the PRs adding offset encoding, I've been creating new index versions for each backport. The index version SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_BOOLEAN_BACKPORT_8_X (8_529) is still pending in backport PR #125596.

Instead of adding a new version, should I update #125596 to instead use 8_528 for the boolean field mapper, since there hasn't been an 8.x release yet?

If so, should I also use 8_528 for future offset encoding backports (unsigned long and scaled float)?

Then I would update this PR to use 8_528 for both numeric and boolean fields.

Copy link
Contributor Author

@jordan-powers jordan-powers Mar 25, 2025

Choose a reason for hiding this comment

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

OK, I opened #125610 to use 8_527 for all the 8.x offset encoding implementations. I also updated the version checks here to always just look at 8_527. Which is what we were already doing, so this PR is essentially just renaming the constant.

public static final IndexVersion UPGRADE_TO_LUCENE_10_0_0 = def(9_000_0_00, Version.LUCENE_10_0_0);
public static final IndexVersion LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT = def(9_001_0_00, Version.LUCENE_10_0_0);
public static final IndexVersion TIME_BASED_K_ORDERED_DOC_ID = def(9_002_0_00, Version.LUCENE_10_0_0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ public BooleanFieldMapper build(MapperBuilderContext context) {
stored.getValue(),
this,
indexCreatedVersion,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_BOOLEAN
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_BOOLEAN,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_BOOLEAN_BACKPORT_8_X
);
return new BooleanFieldMapper(
leafName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ static String getOffsetsFieldName(
boolean isStored,
FieldMapper.Builder fieldMapperBuilder,
IndexVersion indexCreatedVersion,
IndexVersion minSupportedVersionMain
IndexVersion minSupportedVersionMain,
IndexVersion minSupportedVersion8x
) {
var sourceKeepMode = fieldMapperBuilder.sourceKeepMode.orElse(indexSourceKeepMode);
if (context.isSourceSynthetic()
Expand All @@ -100,7 +101,7 @@ static String getOffsetsFieldName(
&& context.isInNestedContext() == false
&& fieldMapperBuilder.copyTo.copyToFields().isEmpty()
&& fieldMapperBuilder.multiFieldsBuilder.hasMultiFields() == false
&& indexVersionSupportStoringArraysNatively(indexCreatedVersion, minSupportedVersionMain)) {
&& indexVersionSupportStoringArraysNatively(indexCreatedVersion, minSupportedVersionMain, minSupportedVersion8x)) {
// Skip stored, we will be synthesizing from stored fields, no point to keep track of the offsets
// Skip copy_to and multi fields, supporting that requires more work. However, copy_to usage is rare in metrics and
// logging use cases
Expand All @@ -115,13 +116,11 @@ && indexVersionSupportStoringArraysNatively(indexCreatedVersion, minSupportedVer

private static boolean indexVersionSupportStoringArraysNatively(
IndexVersion indexCreatedVersion,
IndexVersion minSupportedVersionMain
IndexVersion minSupportedVersionMain,
IndexVersion minSupportedVersion8x
) {
return indexCreatedVersion.onOrAfter(minSupportedVersionMain)
|| indexCreatedVersion.between(
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X,
IndexVersions.UPGRADE_TO_LUCENE_10_0_0
);
|| indexCreatedVersion.between(minSupportedVersion8x, IndexVersions.UPGRADE_TO_LUCENE_10_0_0);
}

private static class Offsets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public IpFieldMapper build(MapperBuilderContext context) {
stored.getValue(),
this,
indexCreatedVersion,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_IP
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_IP,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X
);
return new IpFieldMapper(
leafName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ public KeywordFieldMapper build(MapperBuilderContext context) {
stored.getValue(),
this,
indexCreatedVersion,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_KEYWORD_BACKPORT_8_X
);
return new KeywordFieldMapper(
leafName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ public NumberFieldMapper build(MapperBuilderContext context) {
stored.getValue(),
this,
indexCreatedVersion,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER,
IndexVersions.SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_NUMBER_BACKPORT_8_X
);
return new NumberFieldMapper(leafName(), ft, builderParams(this, context), context.isSourceSynthetic(), this, offsetsFieldName);
}
Expand Down