diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7faf76eddf1..29644bba1f26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,6 @@ jobs: fail-fast: false matrix: java-version: - - 17 # Keep testing on JDK 17 to ensure basic backward compatibility - 21 timeout-minutes: 45 steps: diff --git a/README.md b/README.md index 3de72f5f1558..e93d0c57c9e7 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ information about reporting vulnerabilities. ## Build requirements * Mac OS X or Linux -* Java 17.0.8+, 64-bit +* Java 21.0.1+, 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 17 is selected (create one if none exist) -* In the Project section, ensure the Project language level is set to 17 +* 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 ### Running a testing server diff --git a/core/trino-main/src/main/java/io/trino/dispatcher/DecoratingListeningExecutorService.java b/core/trino-main/src/main/java/io/trino/dispatcher/DecoratingListeningExecutorService.java index e9ef1b4fe9f2..b53b4d9d4310 100644 --- a/core/trino-main/src/main/java/io/trino/dispatcher/DecoratingListeningExecutorService.java +++ b/core/trino-main/src/main/java/io/trino/dispatcher/DecoratingListeningExecutorService.java @@ -16,45 +16,23 @@ import com.google.common.util.concurrent.ForwardingListeningExecutorService; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; -import jakarta.annotation.Nullable; -import java.lang.invoke.MethodHandle; -import java.lang.reflect.Method; import java.time.Duration; import java.util.Collection; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import static com.google.common.base.Throwables.throwIfUnchecked; import static com.google.common.collect.ImmutableList.toImmutableList; -import static io.trino.util.Reflection.methodHandle; import static java.util.Objects.requireNonNull; public class DecoratingListeningExecutorService extends ForwardingListeningExecutorService implements ListeningExecutorService { - // TODO remove after requiring Java 19+ for runtime. - private static final @Nullable MethodHandle CLOSE_METHOD; - - static { - Method closeMethod; - try { - closeMethod = ExecutorService.class.getMethod("close"); - } - catch (NoSuchMethodException e) { - closeMethod = null; - } - CLOSE_METHOD = closeMethod != null - ? methodHandle(closeMethod) - : null; - } - private final ListeningExecutorService delegate; private final TaskDecorator decorator; @@ -194,21 +172,10 @@ public boolean awaitTermination(Duration duration) return super.awaitTermination(duration); } - // TODO This is temporary, until Guava's ForwardingExecutorService has the method in their interface. See https://github.com/google/guava/issues/6296 - //@Override + @Override public void close() { - if (CLOSE_METHOD == null) { - throw new UnsupportedOperationException("ExecutorService.close has close() method since Java 19. " + - "The DecoratingListeningExecutorService supports the method only when run with Java 19 runtime."); - } - try { - CLOSE_METHOD.invoke(delegate()); - } - catch (Throwable e) { - throwIfUnchecked(e); - throw new RuntimeException(e); - } + delegate.close(); } public interface TaskDecorator diff --git a/core/trino-main/src/main/java/io/trino/server/TrinoSystemRequirements.java b/core/trino-main/src/main/java/io/trino/server/TrinoSystemRequirements.java index d5ce9b4e969b..d3ec3cba1792 100644 --- a/core/trino-main/src/main/java/io/trino/server/TrinoSystemRequirements.java +++ b/core/trino-main/src/main/java/io/trino/server/TrinoSystemRequirements.java @@ -94,7 +94,7 @@ else if ("Mac OS X".equals(osName)) { private static void verifyJavaVersion() { - Version required = Version.parse("17.0.8"); + Version required = Version.parse("21.0.1"); if (Runtime.version().compareTo(required) < 0) { failRequirement("Trino requires Java %s at minimum (found %s)", required, Runtime.version()); 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 8cdd002f2866..b53af87c41ed 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 @@ -29,8 +29,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 < 17) { - System.err.println(format("ERROR: Trino requires Java 17+ (found %s)", javaVersion)); + if (major == null || major < 21) { + System.err.println(format("ERROR: Trino requires Java 21+ (found %s)", javaVersion)); System.exit(100); } diff --git a/core/trino-server-rpm/src/main/rpm/preinstall b/core/trino-server-rpm/src/main/rpm/preinstall index 0bf1e4a8fae4..dbbf425b2c6c 100644 --- a/core/trino-server-rpm/src/main/rpm/preinstall +++ b/core/trino-server-rpm/src/main/rpm/preinstall @@ -22,7 +22,7 @@ check_if_correct_java_version() { # candidate for JAVA_HOME). JAVA_VERSION=$(java_version "$1") JAVA_MAJOR=$(echo "$JAVA_VERSION" | cut -d'.' -f1) - if [ "$JAVA_MAJOR" -ge "17" ]; then + if [ "$JAVA_MAJOR" -ge "21" ]; then echo "$1" >/tmp/trino-rpm-install-java-home return 0 else @@ -34,10 +34,6 @@ check_if_correct_java_version() { if ! check_if_correct_java_version "$JAVA_HOME"; then java_found=false for candidate in \ - /usr/lib/jvm/java-17-* \ - /usr/lib/jvm/zulu-17 \ - /usr/lib/jvm/temurin-17 \ - /usr/lib/jvm/temurin-17-* \ /usr/lib/jvm/java-21-* \ /usr/lib/jvm/zulu-21 \ /usr/lib/jvm/temurin-21 \ @@ -61,7 +57,7 @@ if [ "$java_found" = false ]; then +======================================================================+ | Error: Required Java version could not be found | +----------------------------------------------------------------------+ -| JDK 17 was not detected. | +| JDK 21 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 37b6dbb0b1f2..2b5276800526 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 @@ -56,7 +56,6 @@ public ServerIT() @Test public void testInstall() { - testInstall("17"); testInstall("21"); } @@ -107,7 +106,6 @@ private void testInstall(String javaVersion) public void testUninstall() throws Exception { - testUninstall("17"); testUninstall("21"); } diff --git a/docs/src/main/sphinx/functions/conversion.md b/docs/src/main/sphinx/functions/conversion.md index 7de546ab7ed8..8fb09e16c005 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/17/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/21/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 cbc853e0ecc7..e78939d96eb4 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/17/docs/api/java.base/java/util/regex/Pattern.html#gnumber -[capturing groups]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html#cg -[java pattern]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html +[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 diff --git a/docs/src/main/sphinx/installation/deployment.md b/docs/src/main/sphinx/installation/deployment.md index 1d5ef0704b9f..b3139babc7d5 100644 --- a/docs/src/main/sphinx/installation/deployment.md +++ b/docs/src/main/sphinx/installation/deployment.md @@ -35,19 +35,15 @@ ### Java runtime environment -Trino requires a 64-bit version of Java 17, with a minimum required version of 17.0.8. -Earlier major versions such as Java 8 or Java 11 do not work. -Newer major versions such as Java 18 or 19, are not supported -- they may work, but are not tested. +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. We recommend using the Eclipse Temurin OpenJDK distribution from [Adoptium](https://adoptium.net/) as the JDK for Trino, as Trino is tested against that distribution. Eclipse Temurin is also the JDK used by the [Trino Docker image](https://hub.docker.com/r/trinodb/trino). -If you are using Java 17 or 18, the JVM must be configured to use UTF-8 as the default charset by -adding `-Dfile.encoding=UTF-8` to `etc/jvm.config`. Starting with Java 19, the Java default -charset is UTF-8, so this configuration is not needed. - (requirements-python)= ### Python diff --git a/docs/src/main/sphinx/security/tls.md b/docs/src/main/sphinx/security/tls.md index 775a20f4e61b..f46caa1fcdc3 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 17 -lists its [supported cipher suites](https://docs.oracle.com/en/java/javase/17/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 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). 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/17/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/21/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 176e613cb0f3..58ec6c716aa5 100644 --- a/pom.xml +++ b/pom.xml @@ -137,12 +137,12 @@ - 17 + 21 true true true - 17.0.8 + 21.0.1 -missing ${project.basedir} 8