From d285be23b55ec45af2ec688b821415dc5b8d816d Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Wed, 27 Mar 2024 09:53:15 +0100 Subject: [PATCH] Require JDK 22.0.0 to build and run Trino --- .github/workflows/ci.yml | 1 - .java-version | 2 +- .mvn/jvm.config | 1 - README.md | 6 +++--- core/docker/default/etc/jvm.config | 3 --- .../src/main/java/io/trino/server/TrinoServer.java | 5 ++--- .../src/main/resources/dist/config/jvm.config | 3 --- core/trino-server-rpm/src/main/rpm/preinstall | 6 +----- .../src/test/java/io/trino/server/rpm/ServerIT.java | 3 --- docs/src/main/sphinx/admin/resource-groups.md | 2 +- docs/src/main/sphinx/functions/conversion.md | 2 +- docs/src/main/sphinx/functions/regexp.md | 6 +++--- docs/src/main/sphinx/installation/deployment.md | 11 +++-------- docs/src/main/sphinx/security/tls.md | 6 +++--- pom.xml | 6 ++---- 15 files changed, 20 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8395ad91ee1c..1e03d1a0b289 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,6 @@ jobs: fail-fast: false matrix: include: - - { java-version: 21, cache: 'true', cleanup-node: false } - { java-version: 22, cache: 'restore', cleanup-node: false } - { java-version: 23-ea, cache: 'restore', cleanup-node: true } timeout-minutes: 45 diff --git a/.java-version b/.java-version index aabe6ec3909c..2bd5a0a98a36 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -21 +22 diff --git a/.mvn/jvm.config b/.mvn/jvm.config index a5fd01e4f52c..6f744c26dcd5 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -10,5 +10,4 @@ --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -XX:+UnlockDiagnosticVMOptions --XX:GCLockerRetryAllocationCount=100 -XX:+ExitOnOutOfMemoryError diff --git a/README.md b/README.md index e93d0c57c9e7..f275ea4c15ee 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ information about reporting vulnerabilities. ## Build requirements * Mac OS X or Linux -* Java 21.0.1+, 64-bit +* Java 22.0.0+, 64-bit * Docker * Turn SELinux or other systems disabling write access to the local checkout off, to allow containers to mount parts of the Trino source tree @@ -70,8 +70,8 @@ After opening the project in IntelliJ, double check that the Java SDK is properly configured for the project: * Open the File menu and select Project Structure -* In the SDKs section, ensure that JDK 21 is selected (create one if none exist) -* In the Project section, ensure the Project language level is set to 21 +* In the SDKs section, ensure that JDK 22 is selected (create one if none exist) +* In the Project section, ensure the Project language level is set to 22 ### Running a testing server diff --git a/core/docker/default/etc/jvm.config b/core/docker/default/etc/jvm.config index 0a6bca1bc2fa..a4733ac50170 100644 --- a/core/docker/default/etc/jvm.config +++ b/core/docker/default/etc/jvm.config @@ -12,8 +12,5 @@ -XX:PerBytecodeRecompilationCutoff=10000 -Djdk.attach.allowAttachSelf=true -Djdk.nio.maxCachedBufferSize=2000000 -# Reduce starvation of threads by GClocker, recommend to set about the number of cpu cores (JDK-8192647) --XX:+UnlockDiagnosticVMOptions --XX:GCLockerRetryAllocationCount=32 # Allow loading dynamic agent used by JOL -XX:+EnableDynamicAgentLoading diff --git a/core/trino-server-main/src/main/java/io/trino/server/TrinoServer.java b/core/trino-server-main/src/main/java/io/trino/server/TrinoServer.java index b53af87c41ed..58626c837c5b 100644 --- a/core/trino-server-main/src/main/java/io/trino/server/TrinoServer.java +++ b/core/trino-server-main/src/main/java/io/trino/server/TrinoServer.java @@ -18,7 +18,6 @@ import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.base.Strings.nullToEmpty; -import static java.lang.String.format; public final class TrinoServer { @@ -29,8 +28,8 @@ public static void main(String[] args) String javaVersion = nullToEmpty(StandardSystemProperty.JAVA_VERSION.value()); String majorVersion = javaVersion.split("\\D", 2)[0]; Integer major = Ints.tryParse(majorVersion); - if (major == null || major < 21) { - System.err.println(format("ERROR: Trino requires Java 21+ (found %s)", javaVersion)); + if (major == null || major < 22) { + System.err.printf("ERROR: Trino requires Java 22+ (found %s)%n", javaVersion); System.exit(100); } diff --git a/core/trino-server-rpm/src/main/resources/dist/config/jvm.config b/core/trino-server-rpm/src/main/resources/dist/config/jvm.config index f9d739fbd3ab..d498b4ec1fea 100644 --- a/core/trino-server-rpm/src/main/resources/dist/config/jvm.config +++ b/core/trino-server-rpm/src/main/resources/dist/config/jvm.config @@ -11,8 +11,5 @@ -XX:PerBytecodeRecompilationCutoff=10000 -Djdk.attach.allowAttachSelf=true -Djdk.nio.maxCachedBufferSize=2000000 -# Reduce starvation of threads by GClocker, recommend to set about the number of cpu cores (JDK-8192647) --XX:+UnlockDiagnosticVMOptions --XX:GCLockerRetryAllocationCount=32 # Allow loading dynamic agent used by JOL -XX:+EnableDynamicAgentLoading diff --git a/core/trino-server-rpm/src/main/rpm/preinstall b/core/trino-server-rpm/src/main/rpm/preinstall index 90e9e1f80c7c..9c0a3eea48b6 100644 --- a/core/trino-server-rpm/src/main/rpm/preinstall +++ b/core/trino-server-rpm/src/main/rpm/preinstall @@ -34,12 +34,8 @@ check_if_correct_java_version() { if ! check_if_correct_java_version "$JAVA_HOME"; then java_found=false for candidate in \ - /usr/lib/jvm/java-21-* \ /usr/lib/jvm/java-22-* \ - /usr/lib/jvm/zulu-21 \ /usr/lib/jvm/zulu-22 \ - /usr/lib/jvm/temurin-21 \ - /usr/lib/jvm/temurin-21-* \ /usr/lib/jvm/temurin-22 \ /usr/lib/jvm/temurin-22-* \ /usr/lib/jvm/default-java \ @@ -61,7 +57,7 @@ if [ "$java_found" = false ]; then +======================================================================+ | Error: Required Java version could not be found | +----------------------------------------------------------------------+ -| JDK 21 was not detected. | +| JDK 22 was not detected. | | Recommended JDK distribution is Eclipse Temurin. | | Installation guide: https://adoptium.net/installation/linux/ | | | diff --git a/core/trino-server-rpm/src/test/java/io/trino/server/rpm/ServerIT.java b/core/trino-server-rpm/src/test/java/io/trino/server/rpm/ServerIT.java index da965c863af9..a8d85b9389bd 100644 --- a/core/trino-server-rpm/src/test/java/io/trino/server/rpm/ServerIT.java +++ b/core/trino-server-rpm/src/test/java/io/trino/server/rpm/ServerIT.java @@ -75,9 +75,6 @@ public void testInstallUninstall() throws Exception { // Release names as in the https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getReleaseNames - testInstall("jdk-21.0.2+13", "/usr/lib/jvm/temurin-21", "21"); - testUninstall("jdk-21.0.2+13", "/usr/lib/jvm/temurin-21"); - testInstall("jdk-22+36", "/usr/lib/jvm/temurin-22", "22"); testUninstall("jdk-22+36", "/usr/lib/jvm/temurin-22"); } diff --git a/docs/src/main/sphinx/admin/resource-groups.md b/docs/src/main/sphinx/admin/resource-groups.md index a7699379ac54..1462dffa6a8e 100644 --- a/docs/src/main/sphinx/admin/resource-groups.md +++ b/docs/src/main/sphinx/admin/resource-groups.md @@ -162,7 +162,7 @@ evenly and each receive 50% of the queries in a given timeframe. The selector rules for pattern matching use Java's regular expression capabilities. Java implements regular expressions through the `java.util.regex` package. For more information, see the [Java -documentation](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html). +documentation](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/regex/Pattern.html). - `user` (optional): Java regex to match against user name. diff --git a/docs/src/main/sphinx/functions/conversion.md b/docs/src/main/sphinx/functions/conversion.md index 8fb09e16c005..1bac63fe8c94 100644 --- a/docs/src/main/sphinx/functions/conversion.md +++ b/docs/src/main/sphinx/functions/conversion.md @@ -22,7 +22,7 @@ Like {func}`cast`, but returns null if the cast fails. ## Formatting :::{function} format(format, args...) -> varchar -Returns a formatted string using the specified [format string](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Formatter.html#syntax) +Returns a formatted string using the specified [format string](https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/Formatter.html#syntax) and arguments: ``` diff --git a/docs/src/main/sphinx/functions/regexp.md b/docs/src/main/sphinx/functions/regexp.md index e78939d96eb4..8ced5196cf59 100644 --- a/docs/src/main/sphinx/functions/regexp.md +++ b/docs/src/main/sphinx/functions/regexp.md @@ -184,6 +184,6 @@ SELECT regexp_split('1a 2b 14m', '\s*[a-z]+\s*'); -- [1, 2, 14, ] ``` ::: -[capturing group number]: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html#gnumber -[capturing groups]: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html#cg -[java pattern]: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html +[capturing group number]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/regex/Pattern.html#gnumber +[capturing groups]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/regex/Pattern.html#cg +[java pattern]: https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/util/regex/Pattern.html diff --git a/docs/src/main/sphinx/installation/deployment.md b/docs/src/main/sphinx/installation/deployment.md index 71514738ba68..523c335a9b08 100644 --- a/docs/src/main/sphinx/installation/deployment.md +++ b/docs/src/main/sphinx/installation/deployment.md @@ -35,9 +35,9 @@ ### Java runtime environment -Trino requires a 64-bit version of Java 21, with a minimum required version of 21.0.1. -Earlier major versions such as Java 8, Java 11 or Java 17 do not work. -Newer major versions such as Java 22 are not supported -- they may work, but are not tested. +Trino requires a 64-bit version of Java 22, with a minimum required version of 22.0.0. +Earlier versions such as Java 8, Java 11, Java 17 or Java 21 do not work. +Newer versions such as Java 23 are not supported -- they may work, but are not tested. We recommend using the Eclipse Temurin OpenJDK distribution from [Adoptium](https://adoptium.net/) as the JDK for Trino, as Trino is tested @@ -142,9 +142,6 @@ The following provides a good starting point for creating `etc/jvm.config`: -Djdk.attach.allowAttachSelf=true -Djdk.nio.maxCachedBufferSize=2000000 -Dfile.encoding=UTF-8 -# Reduce starvation of threads by GClocker, recommend to set about the number of cpu cores (JDK-8192647) --XX:+UnlockDiagnosticVMOptions --XX:GCLockerRetryAllocationCount=32 # Allow loading dynamic agent used by JOL -XX:+EnableDynamicAgentLoading ``` @@ -177,8 +174,6 @@ prevents Trino from starting. You can workaround this by overriding the temporary directory by adding `-Djava.io.tmpdir=/path/to/other/tmpdir` to the list of JVM options. -We set GCLocker retry allocation count (`-XX:GCLockerRetryAllocationCount=32`) to avoid OOM too early (see [JDK-8192647](https://bugs.openjdk.org/browse/JDK-8192647)) - (config-properties)= ### Config properties diff --git a/docs/src/main/sphinx/security/tls.md b/docs/src/main/sphinx/security/tls.md index f46caa1fcdc3..db021c030e74 100644 --- a/docs/src/main/sphinx/security/tls.md +++ b/docs/src/main/sphinx/security/tls.md @@ -26,8 +26,8 @@ using TLS 1.2 and TLS 1.3 certificates. The server rejects TLS 1.1, TLS 1.0, and all SSL format certificates. The Trino server does not specify a set of supported ciphers, instead deferring -to the defaults set by the JVM version in use. The documentation for Java 21 -lists its [supported cipher suites](https://docs.oracle.com/en/java/javase/21/security/oracle-providers.html#GUID-7093246A-31A3-4304-AC5F-5FB6400405E2__SUNJSSE_CIPHER_SUITES). +to the defaults set by the JVM version in use. The documentation for Java 22 +lists its [supported cipher suites](https://docs.oracle.com/en/java/javase/22/security/oracle-providers.html#GUID-7093246A-31A3-4304-AC5F-5FB6400405E2__SUNJSSE_CIPHER_SUITES). Run the following two-line code on the same JVM from the same vendor as configured on the coordinator to determine that JVM's default cipher list. @@ -56,7 +56,7 @@ considered in conjunction with your organization's security managers. Using a different suite may require downloading and installing a different SunJCE implementation package. Some locales may have export restrictions on cipher suites. See the discussion in Java documentation that begins with [Customizing -the Encryption Algorithm Providers](https://docs.oracle.com/en/java/javase/21/security/java-secure-socket-extension-jsse-reference-guide.html#GUID-316FB978-7588-442E-B829-B4973DB3B584). +the Encryption Algorithm Providers](https://docs.oracle.com/en/java/javase/22/security/java-secure-socket-extension-jsse-reference-guide.html#GUID-316FB978-7588-442E-B829-B4973DB3B584). :::{note} If you manage the coordinator's direct TLS implementatation, monitor the CPU diff --git a/pom.xml b/pom.xml index d203be74a1a7..d3ad33f2695e 100644 --- a/pom.xml +++ b/pom.xml @@ -141,14 +141,14 @@ - 21 + 22 ERROR true true true - 21.0.1 + 22.0.0 syntax,reference,html,-missing ${project.basedir} 8 @@ -171,8 +171,6 @@ -XX:G1HeapRegionSize=32M -XX:+UnlockDiagnosticVMOptions - - -XX:GCLockerRetryAllocationCount=10 -XX:+EnableDynamicAgentLoading