Skip to content

Add JDK 21 test task to simdvec module#145007

Merged
ChrisHegarty merged 6 commits intoelastic:mainfrom
ChrisHegarty:simdvec-test-java21
Mar 30, 2026
Merged

Add JDK 21 test task to simdvec module#145007
ChrisHegarty merged 6 commits intoelastic:mainfrom
ChrisHegarty:simdvec-test-java21

Conversation

@ChrisHegarty
Copy link
Copy Markdown
Contributor

@ChrisHegarty ChrisHegarty commented Mar 26, 2026

This commit adds a testJava21 Gradle task to simdvec that automatically runs the simdvec test suite under JDK 21 as part of test.

Now that the main22 source set will be merged into main (with runtime SUPPORTS_HEAP_SEGMENTS guards replacing compile-time MR-JAR separation), it is important to continuously verify that the simdvec code behaves correctly on JDK 21, where heap-backed MemorySegments cannot be passed to native downcalls and the scorer create() methods must return Optional.empty().

The new task uses the Gradle toolchain service to select a JDK 21 launcher, independent of the global runtime.java setting, and sets executable explicitly to override the global runtime-jdk-provision. It is wired into check so that both CI and local builds exercise both JDK paths automatically. When the runtime JDK is already 21 the task is skipped to avoid running the same tests twice.

JDK 21 failures tend to be painful to diagnose after the fact, so catching regressions early, at build time rather than post merge in CI, is well worth the extra few seconds of test time.

@ChrisHegarty ChrisHegarty added >test Issues or PRs that are addressing/adding tests :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch labels Mar 26, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@thecoop
Copy link
Copy Markdown
Member

thecoop commented Mar 26, 2026

To confirm, check is run as part of CI?

@ChrisHegarty
Copy link
Copy Markdown
Contributor Author

To confirm, check is run as part of CI?

It is, but actually it would be better to make test depend upon testJava21. I'll update the PR.

@ChrisHegarty ChrisHegarty merged commit 03b6f2d into elastic:main Mar 30, 2026
36 checks passed
mamazzol pushed a commit to mamazzol/elasticsearch that referenced this pull request Mar 30, 2026
This commit adds a testJava21 Gradle task to simdvec that automatically runs the simdvec test suite under JDK 21 as part of test.

Now that the main22 source set will be merged into main (with runtime SUPPORTS_HEAP_SEGMENTS guards replacing compile-time MR-JAR separation), it is important to continuously verify that the simdvec code behaves correctly on JDK 21, where heap-backed MemorySegments cannot be passed to native downcalls and the scorer create() methods must return Optional.empty().

The new task uses the Gradle toolchain service to select a JDK 21 launcher, independent of the global runtime.java setting, and sets executable explicitly to override the global runtime-jdk-provision. It is wired into check so that both CI and local builds exercise both JDK paths automatically. When the runtime JDK is already 21 the task is skipped to avoid running the same tests twice.

JDK 21 failures tend to be painful to diagnose after the fact, so catching regressions early, at build time rather than post merge in CI, is well worth the extra few seconds of test time.
mouhc1ne pushed a commit to shmuelhanoch/elasticsearch that referenced this pull request Mar 31, 2026
This commit adds a testJava21 Gradle task to simdvec that automatically runs the simdvec test suite under JDK 21 as part of test.

Now that the main22 source set will be merged into main (with runtime SUPPORTS_HEAP_SEGMENTS guards replacing compile-time MR-JAR separation), it is important to continuously verify that the simdvec code behaves correctly on JDK 21, where heap-backed MemorySegments cannot be passed to native downcalls and the scorer create() methods must return Optional.empty().

The new task uses the Gradle toolchain service to select a JDK 21 launcher, independent of the global runtime.java setting, and sets executable explicitly to override the global runtime-jdk-provision. It is wired into check so that both CI and local builds exercise both JDK paths automatically. When the runtime JDK is already 21 the task is skipped to avoid running the same tests twice.

JDK 21 failures tend to be painful to diagnose after the fact, so catching regressions early, at build time rather than post merge in CI, is well worth the extra few seconds of test time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch >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.

3 participants