Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for JDK17 and removing JDK8 #2025

Merged

Conversation

martin-gaievski
Copy link
Member

Description

Making necessary adjustments to make build compatible with JDK17:

  • add add-exports arguments due to java.lang.IllegalAccessError when spotlessJavaCheck uses classes from com.sun.*
  • remove bad javadoc formatting as this generates warnings and build is running with -Werror option

Changing runtime java version from 8 to 11.

Issues Resolved

Remove support for Java 8, add support for Java 17

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@opensearch-ci-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 988b457
Log 2143

Reports 2143

@dreamer-89
Copy link
Member

Gradle check is failing testWithKeywordLongAndMissingBucket test which seems flaky. Its worth retyring Gradle check again.

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.testWithKeywordLongAndMissingBucket" -Dtests.seed=4E1342EC6B964D83 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=zh-Hans-CN -Dtests.timezone=Europe/Isle_of_Man -Druntime.java=17

org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests > testWithKeywordLongAndMissingBucket FAILED
    org.junit.ComparisonFailure: expected:<{keyword=null, long=[null]}> but was:<{keyword=null, long=[100]}>
        at __randomizedtesting.SeedInfo.seed([4E1342EC6B964D83:AF2CA28B0C4823CC]:0)
        at org.junit.Assert.assertEquals(Assert.java:117)
        at org.junit.Assert.assertEquals(Assert.java:146)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.lambda$testWithKeywordLongAndMissingBucket$85(CompositeAggregatorTests.java:1057)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.executeTestCase(CompositeAggregatorTests.java:2712)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.testSearchCase(CompositeAggregatorTests.java:2660)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.testWithKeywordLongAndMissingBucket(CompositeAggregatorTests.java:1045)

@@ -11,7 +11,12 @@

org.gradle.warning.mode=none
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Xss2m
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Xss2m \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am wondering why these exports are needed? AFAIK OpenSearch does not use Java Compiler API, do you have an example at hand? Thank you.

Copy link
Member Author

Choose a reason for hiding this comment

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

hey Andriy,
Options are required to overcome the issue from spotlessJavaCheck task, it's called from OS formatting.gradle script.

example of stack-trace:

Caused by: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.RemoveUnusedImports (in unnamed module @0x63239047) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x63239047
        at com.google.googlejavaformat.java.RemoveUnusedImports.removeUnusedImports(RemoveUnusedImports.java:187)
        ... 139 more

some public discussions on the issue and possible workaround - google/google-java-format#612, https://stackoverflow.com/questions/58082298/gradle-run-with-add-exports, https://zenn.dev/yuta_saito/articles/8b185a3786088b.
^ @reta

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah ... thank you @martin-gaievski , spotless again ...

@martin-gaievski
Copy link
Member Author

Gradle check is failing testWithKeywordLongAndMissingBucket test which seems flaky. Its worth retyring Gradle check again.

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.testWithKeywordLongAndMissingBucket" -Dtests.seed=4E1342EC6B964D83 -Dtests.security.manager=true -Dtests.jvm.argline="-XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=64m" -Dtests.locale=zh-Hans-CN -Dtests.timezone=Europe/Isle_of_Man -Druntime.java=17

org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests > testWithKeywordLongAndMissingBucket FAILED
    org.junit.ComparisonFailure: expected:<{keyword=null, long=[null]}> but was:<{keyword=null, long=[100]}>
        at __randomizedtesting.SeedInfo.seed([4E1342EC6B964D83:AF2CA28B0C4823CC]:0)
        at org.junit.Assert.assertEquals(Assert.java:117)
        at org.junit.Assert.assertEquals(Assert.java:146)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.lambda$testWithKeywordLongAndMissingBucket$85(CompositeAggregatorTests.java:1057)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.executeTestCase(CompositeAggregatorTests.java:2712)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.testSearchCase(CompositeAggregatorTests.java:2660)
        at org.opensearch.search.aggregations.bucket.composite.CompositeAggregatorTests.testWithKeywordLongAndMissingBucket(CompositeAggregatorTests.java:1045)

hey Suraj,
How can I restart the check (Gradle check that you've mentioned)? Checks that are listed in PR's check tab are all green.
^ @dreamer-89

@owaiskazi19
Copy link
Member

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 988b457
Log 2150

Reports 2150

@reta
Copy link
Collaborator

reta commented Feb 1, 2022

x Gradle Check failure 988b457 Log 2150

Reports 2150

Hehe ... @owaiskazi19 seems like without our #2024 PR merged, not much hope for builds to succeed :(

* What went wrong:
Execution failed for task ':distribution:docker:buildDockerImage'.
> A failure occurred while executing org.opensearch.gradle.docker.DockerBuildTask$DockerBuildAction
   > Process 'command 'docker'' finished with non-zero exit value 1

@martin-gaievski martin-gaievski marked this pull request as ready for review February 1, 2022 18:19
@martin-gaievski martin-gaievski requested a review from a team as a code owner February 1, 2022 18:19
@owaiskazi19
Copy link
Member

owaiskazi19 commented Feb 1, 2022

x Gradle Check failure 988b457 Log 2150
Reports 2150

Hehe ... @owaiskazi19 seems like without our #2024 PR merged, not much hope for builds to succeed :(

* What went wrong:
Execution failed for task ':distribution:docker:buildDockerImage'.
> A failure occurred while executing org.opensearch.gradle.docker.DockerBuildTask$DockerBuildAction
   > Process 'command 'docker'' finished with non-zero exit value 1

Yeah. Looks like all the build failed for the same reason. PR is merged. Starting gradle check again.

@owaiskazi19
Copy link
Member

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 988b457
Log 2153

Reports 2153

@dblock
Copy link
Member

dblock commented Feb 2, 2022

Tests with failures:
 - org.opensearch.cluster.routing.MovePrimaryFirstTests.testClusterGreenAfterPartialRelocation

#1957

@dblock
Copy link
Member

dblock commented Feb 2, 2022

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 988b457
Log 2182

Reports 2182

@martin-gaievski martin-gaievski marked this pull request as draft February 2, 2022 20:14
@martin-gaievski martin-gaievski marked this pull request as ready for review February 2, 2022 20:15
@dblock
Copy link
Member

dblock commented Feb 2, 2022

This overlaps with #1977.

@martin-gaievski want to merge these two and update docs?

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@martin-gaievski
Copy link
Member Author

This overlaps with #1977.

@martin-gaievski want to merge these two and update docs?

sure, added changes from #1977 so now this PR consolidates all changes
^ @dblock

@andrross
Copy link
Member

andrross commented Feb 2, 2022

The developer guide needs to be updated as well.

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
@martin-gaievski
Copy link
Member Author

Ack, updated in next commit


To run the full suite of tests, download and install [JDK 8](https://adoptium.net/releases.html?variant=openjdk8) and [JDK 14](https://jdk.java.net/archive/) and set `JAVA8_HOME`, `JAVA11_HOME`, and `JAVA14_HOME`. They are required by the [backwards compatibility test](./TESTING.md#testing-backwards-compatibility).
To run the full suite of tests, download and install [JDK 14](https://jdk.java.net/archive/) and set `JAVA11_HOME`, and `JAVA14_HOME`. They are required by the [backwards compatibility test](./TESTING.md#testing-backwards-compatibility).
Copy link
Collaborator

Choose a reason for hiding this comment

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

@martin-gaievski this is interesting, we are not going to backport this change to 1.x, right? In this case, I am not sure we have to drop the JDK-8 requirements for bwc tests, did you have a chance to check it?

Copy link
Member Author

Choose a reason for hiding this comment

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

@reta As to my knowledge this is not going to be back-ported to 1.x. It's meant to be for 2.0 only as per original requirements from 110.
I've run bwcTest locally for this branch with only JAVA11_HOME and JAVA14_HOME set and it passed without errors.

Copy link
Collaborator

Choose a reason for hiding this comment

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

All set, thank you

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 9660a8c
Log 2196

Reports 2196

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 9d825f2
Log 2197

Reports 2197

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Nice work @martin-gaievski, thanks!

@dblock dblock merged commit 3093975 into opensearch-project:main Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants