TsidExtractingIdFieldMapperTests synthetic id#143404
Merged
burqen merged 4 commits intoelastic:mainfrom Mar 5, 2026
Merged
Conversation
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.
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
16 tasks
Contributor
Author
|
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? |
tlrx
approved these changes
Mar 4, 2026
Member
tlrx
left a comment
There was a problem hiding this comment.
LGTM, but I'm not familiar to these tests so please wait for @felixbarny review before merging.
server/src/test/java/org/elasticsearch/index/mapper/TsidExtractingIdFieldMapperTests.java
Outdated
Show resolved
Hide resolved
felixbarny
reviewed
Mar 4, 2026
server/src/test/java/org/elasticsearch/index/mapper/TsidExtractingIdFieldMapperTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/index/mapper/TsidExtractingIdFieldMapperTests.java
Show resolved
Hide resolved
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
Contributor
Author
|
Thanks for the feedback @felixbarny and @tlrx ! Your comments have been addressed now |
felixbarny
approved these changes
Mar 4, 2026
Contributor
Author
|
CI is green, it's just GitHub interface that is not picking it up. Merging. |
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
This was referenced Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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