Skip to content

TsidExtractingIdFieldMapperTests synthetic id#143404

Merged
burqen merged 4 commits intoelastic:mainfrom
burqen:ap/2026.02.26.synthetic-id-fix-TsidExtractingIdFieldMapperTests
Mar 5, 2026
Merged

TsidExtractingIdFieldMapperTests synthetic id#143404
burqen merged 4 commits intoelastic:mainfrom
burqen:ap/2026.02.26.synthetic-id-fix-TsidExtractingIdFieldMapperTests

Conversation

@burqen
Copy link
Copy Markdown
Contributor

@burqen burqen commented Mar 2, 2026

TsidExtractingIdFieldMapperTests run with and without syntheticId. This is preparatory work for enabling synthetic id by default. When turning synthetic id ON by default, this test should continue to function.

Add syntheticId to TestCase; keep existing cases with syntheticId=false,
add a second set of cases with syntheticId=true and synthetic expected
_id/tsid values for routing path and index dimensions.

Before, a random indexVersion would be generated when creating MapperService, but the version was only propagated to settings and didn't actually propagate to the MapperService itself which would use IndexVersion.current() under the hood. The indexVersion now propagates to both MapperService and documentParserContext correctly to make sure all components agree on the use of synthetic id.

The synthetic id setting is set (to true or false) when the feature flag and index version allows it, otherwise it falls back to default behavior.

The default behavior now: Don't use synthetic id.
Default behavior after enabling by default: Use synthetic id if indexVersion allows it.

By explicitly setting syntheticId=false for the existing TestCases when indexVersion has support for synthetic id, we avoid changing the test behavior once synthetic id is enabled by default.

Since IndexVersion is now propagated correctly to MapperService and documentParserContext the tests now need to pass an explicit minimum indexVersion to activate the behavior that is tested.

Skip block loader tests when syntheticId is true (BlockLoaderTestRunner does not support synthetic ID); use fixed index versions for those tests .

In testRoutingHashCompliant* assert routing hash from last 4 bytes BE (synthetic) or first 4 bytes LE (non-synthetic) via getRoutingHash().

TestDocumentParserContext can now take IndexVersion.

Relates #142366

TsidExtractingIdFieldMapperTests run with and without syntheticId. This
is preparatory work for enabling synthetic id by default. When turning
synthetic id ON by default, this test should continue to function.

Add syntheticId to TestCase; keep existing cases with syntheticId=false,
 add a second set of cases with syntheticId=true and synthetic expected
 _id/tsid values for routing path and index dimensions.

Before, a random indexVersion would be generated when creating
MapperService, but the version was only propagated to settings and
didn't actually propagate to the MapperService itself which would use
IndexVersion.current() under the hood. The indexVersion now propagates
to both MapperService and documentParserContext correctly to make sure
all components agree on the use of synthetic id.

The synthetic id setting is set (to true or false) when the feature
flag and index version allows it, otherwise it falls back to default
behavior.

The default behavior now: Don't use synthetic id.
Default behavior after enabling by default: Use synthetic id if
indexVersion allows it.

By explicitly setting syntheticId=false for the existing TestCases
when indexVersion has support for synthetic id, we  avoid changing the
test behavior once synthetic id is enabled by default.

Since IndexVersion is now propagated correctly to MapperService and
documentParserContext the tests now need to pass an explicit minimum
indexVersion to activate the behavior that is tested.

Skip block loader tests when syntheticId is true (BlockLoaderTestRunner
does not support synthetic ID); use fixed index versions for those tests
.

In testRoutingHashCompliant* assert routing hash from last 4 bytes BE
(synthetic) or first 4 bytes LE (non-synthetic) via getRoutingHash().

TestDocumentParserContext can now take IndexVersion.
@burqen burqen added >test Issues or PRs that are addressing/adding tests :StorageEngine/TSDB You know, for Metrics v9.4.0 labels Mar 2, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 3, 2026

I didn't know who would be best to review this from Storage engine but github recommended you and I've seen your name in the code @felixbarny . Can you please have a look or relay to someone else in the team?

Copy link
Copy Markdown
Member

@tlrx tlrx left a comment

Choose a reason for hiding this comment

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

LGTM, but I'm not familiar to these tests so please wait for @felixbarny review before merging.

burqen added 3 commits March 4, 2026 14:06
Refactor TsidExtractingIdFieldMapperTests: one TestCase per scenario
with both normal and synthetic expected IDs, access via
expectedId*(useSyntheticId) and no-arg TSID getters. Parameterize by
(TestCase, useSyntheticId), remove duplicate synthetic case list.

Written together with Cursor
…etic-id-fix-TsidExtractingIdFieldMapperTests
@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 4, 2026

Thanks for the feedback @felixbarny and @tlrx ! Your comments have been addressed now

@burqen
Copy link
Copy Markdown
Contributor Author

burqen commented Mar 5, 2026

CI is green, it's just GitHub interface that is not picking it up. Merging.

@burqen burqen merged commit 4434c14 into elastic:main Mar 5, 2026
26 of 35 checks passed
burqen added a commit to burqen/elasticsearch that referenced this pull request Mar 5, 2026
TsidExtractingIdFieldMapperTests run with and without syntheticId. This
is preparatory work for enabling synthetic id by default. When turning
synthetic id ON by default, this test should continue to function.

Add syntheticId to TestCase; keep existing cases with syntheticId=false,
 add a second set of cases with syntheticId=true and synthetic expected
 _id/tsid values for routing path and index dimensions.

Before, a random indexVersion would be generated when creating
MapperService, but the version was only propagated to settings and
didn't actually propagate to the MapperService itself which would use
IndexVersion.current() under the hood. The indexVersion now propagates
to both MapperService and documentParserContext correctly to make sure
all components agree on the use of synthetic id.

The synthetic id setting is set (to true or false) when the feature
flag and index version allows it, otherwise it falls back to default
behavior.

The default behavior now: Don't use synthetic id.
Default behavior after enabling by default: Use synthetic id if
indexVersion allows it.

By explicitly setting syntheticId=false for the existing TestCases
when indexVersion has support for synthetic id, we  avoid changing the
test behavior once synthetic id is enabled by default.

Since IndexVersion is now propagated correctly to MapperService and
documentParserContext the tests now need to pass an explicit minimum
indexVersion to activate the behavior that is tested.

Skip block loader tests when syntheticId is true (BlockLoaderTestRunner
does not support synthetic ID); use fixed index versions for those tests
.

In testRoutingHashCompliant* assert routing hash from last 4 bytes BE
(synthetic) or first 4 bytes LE (non-synthetic) via getRoutingHash().

TestDocumentParserContext can now take IndexVersion.

* Address minor feedback

* Remove duplicate synthetic case list

Refactor TsidExtractingIdFieldMapperTests: one TestCase per scenario
with both normal and synthetic expected IDs, access via
expectedId*(useSyntheticId) and no-arg TSID getters. Parameterize by
(TestCase, useSyntheticId), remove duplicate synthetic case list.

Written together with Cursor
jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request Mar 5, 2026
TsidExtractingIdFieldMapperTests run with and without syntheticId. This
is preparatory work for enabling synthetic id by default. When turning
synthetic id ON by default, this test should continue to function.

Add syntheticId to TestCase; keep existing cases with syntheticId=false,
 add a second set of cases with syntheticId=true and synthetic expected
 _id/tsid values for routing path and index dimensions.

Before, a random indexVersion would be generated when creating
MapperService, but the version was only propagated to settings and
didn't actually propagate to the MapperService itself which would use
IndexVersion.current() under the hood. The indexVersion now propagates
to both MapperService and documentParserContext correctly to make sure
all components agree on the use of synthetic id.

The synthetic id setting is set (to true or false) when the feature
flag and index version allows it, otherwise it falls back to default
behavior.

The default behavior now: Don't use synthetic id.
Default behavior after enabling by default: Use synthetic id if
indexVersion allows it.

By explicitly setting syntheticId=false for the existing TestCases
when indexVersion has support for synthetic id, we  avoid changing the
test behavior once synthetic id is enabled by default.

Since IndexVersion is now propagated correctly to MapperService and
documentParserContext the tests now need to pass an explicit minimum
indexVersion to activate the behavior that is tested.

Skip block loader tests when syntheticId is true (BlockLoaderTestRunner
does not support synthetic ID); use fixed index versions for those tests
.

In testRoutingHashCompliant* assert routing hash from last 4 bytes BE
(synthetic) or first 4 bytes LE (non-synthetic) via getRoutingHash().

TestDocumentParserContext can now take IndexVersion.

* Address minor feedback

* Remove duplicate synthetic case list

Refactor TsidExtractingIdFieldMapperTests: one TestCase per scenario
with both normal and synthetic expected IDs, access via
expectedId*(useSyntheticId) and no-arg TSID getters. Parameterize by
(TestCase, useSyntheticId), remove duplicate synthetic case list.

Written together with Cursor
spinscale pushed a commit to spinscale/elasticsearch that referenced this pull request Mar 6, 2026
TsidExtractingIdFieldMapperTests run with and without syntheticId. This
is preparatory work for enabling synthetic id by default. When turning
synthetic id ON by default, this test should continue to function.

Add syntheticId to TestCase; keep existing cases with syntheticId=false,
 add a second set of cases with syntheticId=true and synthetic expected
 _id/tsid values for routing path and index dimensions.

Before, a random indexVersion would be generated when creating
MapperService, but the version was only propagated to settings and
didn't actually propagate to the MapperService itself which would use
IndexVersion.current() under the hood. The indexVersion now propagates
to both MapperService and documentParserContext correctly to make sure
all components agree on the use of synthetic id.

The synthetic id setting is set (to true or false) when the feature
flag and index version allows it, otherwise it falls back to default
behavior.

The default behavior now: Don't use synthetic id.
Default behavior after enabling by default: Use synthetic id if
indexVersion allows it.

By explicitly setting syntheticId=false for the existing TestCases
when indexVersion has support for synthetic id, we  avoid changing the
test behavior once synthetic id is enabled by default.

Since IndexVersion is now propagated correctly to MapperService and
documentParserContext the tests now need to pass an explicit minimum
indexVersion to activate the behavior that is tested.

Skip block loader tests when syntheticId is true (BlockLoaderTestRunner
does not support synthetic ID); use fixed index versions for those tests
.

In testRoutingHashCompliant* assert routing hash from last 4 bytes BE
(synthetic) or first 4 bytes LE (non-synthetic) via getRoutingHash().

TestDocumentParserContext can now take IndexVersion.

* Address minor feedback

* Remove duplicate synthetic case list

Refactor TsidExtractingIdFieldMapperTests: one TestCase per scenario
with both normal and synthetic expected IDs, access via
expectedId*(useSyntheticId) and no-arg TSID getters. Parameterize by
(TestCase, useSyntheticId), remove duplicate synthetic case list.

Written together with Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:StorageEngine/TSDB You know, for Metrics Team:StorageEngine >test Issues or PRs that are addressing/adding tests v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants