Skip to content

Commit

Permalink
Require JDK 23.0.1 to run Trino
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Oct 22, 2024
1 parent 4d8b8d1 commit c51db6c
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22
23
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Trino supports [reproducible builds](https://reproducible-builds.org) as of vers
## Build requirements

* Mac OS X or Linux
* Java 22.0.0+, 64-bit
* Java 23.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
Expand Down Expand Up @@ -90,8 +90,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 22 is selected (create one if none exist)
* In the Project section, ensure the Project language level is set to 22
* In the SDKs section, ensure that JDK 23 is selected (create one if none exist)
* In the Project section, ensure the Project language level is set to 23

### Running a testing server

Expand Down
2 changes: 1 addition & 1 deletion core/jdk/current
Original file line number Diff line number Diff line change
@@ -1 +1 @@
temurin/jdk-23+37
temurin/jdk-23.0.1+11
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23+37/linux/x64/jdk/hotspot/normal/eclipse?project=jdk
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23.0.1+11/linux/x64/jdk/hotspot/normal/eclipse?project=jdk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23+37/linux/aarch64/jdk/hotspot/normal/eclipse?project=jdk
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23.0.1+11/linux/aarch64/jdk/hotspot/normal/eclipse?project=jdk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23+37/linux/ppc64le/jdk/hotspot/normal/eclipse?project=jdk
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23.0.1+11/linux/ppc64le/jdk/hotspot/normal/eclipse?project=jdk
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,13 @@
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.OptionalLong;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.lang.Integer.parseInt;
import static java.lang.String.format;
import static java.util.regex.Pattern.quote;

final class TrinoSystemRequirements
{
Expand All @@ -61,7 +55,6 @@ private static void verifyJvmRequirements()
verifyOsArchitecture();
verifyByteOrder();
verifyUsingG1Gc();
verifyJdk8329528Workaround();
verifyFileDescriptor();
verifySlice();
verifyUtf8();
Expand Down Expand Up @@ -107,7 +100,7 @@ else if ("Mac OS X".equals(osName)) {

private static void verifyJavaVersion()
{
Version required = Version.parse("22.0.1");
Version required = Version.parse("23+37");

if (Runtime.version().compareTo(required) < 0) {
failRequirement("Trino requires Java %s at minimum (found %s)", required, Runtime.version());
Expand All @@ -131,17 +124,6 @@ private static void verifyUsingG1Gc()
}
}

private static void verifyJdk8329528Workaround()
{
if (Runtime.version().compareTo(Version.parse("22.0.2")) < 0) {
Optional<String> collectionsKeepPinned = getJvmConfigurationFlag("XX:G1NumCollectionsKeepPinned");
int requiredValue = 10000000;
if (collectionsKeepPinned.isEmpty() || parseInt(collectionsKeepPinned.get()) < requiredValue) {
failRequirement("Trino requires -XX:+UnlockDiagnosticVMOptions -XX:G1NumCollectionsKeepPinned=%d on Java versions lower than 22.0.2 due to JDK-8329528", requiredValue);
}
}
}

private static void verifyFileDescriptor()
{
OptionalLong maxFileDescriptorCount = getMaxFileDescriptorCount();
Expand Down Expand Up @@ -198,24 +180,6 @@ private static void verifySystemTimeIsReasonable()
}
}

private static Optional<String> getJvmConfigurationFlag(String flag)
{
Pattern pattern = Pattern.compile("-%s=(.*)".formatted(quote(flag)), Pattern.DOTALL);
Optional<String> matched = Optional.empty();
List<String> matching = new ArrayList<>(1);
for (String argument : ManagementFactory.getRuntimeMXBean().getInputArguments()) {
Matcher matcher = pattern.matcher(argument);
if (matcher.matches()) {
matched = Optional.of(matcher.group(1));
matching.add(argument);
}
}
if (matching.size() > 1) {
failRequirement("Multiple JVM configuration flags matched %s: %s", pattern.pattern(), matching);
}
return matched;
}

@FormatMethod
private static void failRequirement(String format, Object... args)
{
Expand Down
8 changes: 2 additions & 6 deletions core/trino-server-rpm/src/main/rpm/preinstall
Original file line number Diff line number Diff line change
Expand Up @@ -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 | cut -d'.' -f1)
if [ "$JAVA_MAJOR" -ge "22" ]; then
if [ "$JAVA_MAJOR" -ge "23" ]; then
echo "$1" >/tmp/trino-rpm-install-java-home
return 0
else
Expand All @@ -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-22-* \
/usr/lib/jvm/zulu-22 \
/usr/lib/jvm/temurin-22 \
/usr/lib/jvm/temurin-22-* \
/usr/lib/jvm/java-23-* \
/usr/lib/jvm/zulu-23 \
/usr/lib/jvm/temurin-23 \
Expand All @@ -61,7 +57,7 @@ if [ "$java_found" = false ]; then
+======================================================================+
| Error: Required Java version could not be found |
+----------------------------------------------------------------------+
| JDK 22 or 23 was not detected. |
| JDK 23 was not detected. |
| Recommended JDK distribution is Eclipse Temurin. |
| Installation guide: https://adoptium.net/installation/linux/ |
| |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public void testInstallUninstall()
throws Exception
{
// Release names as in the https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getReleaseNames
testInstall("jdk-23+37", "/usr/lib/jvm/temurin-23", "23");
testUninstall("jdk-23+37", "/usr/lib/jvm/temurin-23");
testInstall("jdk-23.0.1+11", "/usr/lib/jvm/temurin-23", "23");
testUninstall("jdk-23.0.1+11", "/usr/lib/jvm/temurin-23");
}

private void testInstall(String temurinReleaseName, String javaHome, String expectedJavaVersion)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/sphinx/admin/resource-groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/22/docs/api/java.base/java/util/regex/Pattern.html).
documentation](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/regex/Pattern.html).

- `user` (optional): Java regex to match against user name.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/sphinx/functions/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/22/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/23/docs/api/java.base/java/util/Formatter.html#syntax)
and arguments:

```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/sphinx/functions/regexp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/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
[capturing group number]: https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/regex/Pattern.html#gnumber
[capturing groups]: https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/regex/Pattern.html#cg
[java pattern]: https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/util/regex/Pattern.html
8 changes: 4 additions & 4 deletions docs/src/main/sphinx/installation/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
(requirements-java)=
### Java runtime environment

Trino requires a 64-bit version of Java 22, with a minimum required version of
22.0.1 and a recommendation to use the latest patch version. Earlier major 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.
Trino requires a 64-bit version of Java 23, with a minimum required version of
23.0.0 and a recommendation to use the latest patch version. Earlier versions
such as Java 8, Java 11, Java 17, Java 21 or Java 22 do not work.
Newer versions such as Java 24 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
Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/sphinx/security/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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 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).
lists its [supported cipher suites](https://docs.oracle.com/en/java/javase/23/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.
Expand Down Expand Up @@ -55,7 +55,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/22/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/23/security/java-secure-socket-extension-jsse-reference-guide.html#GUID-316FB978-7588-442E-B829-B4973DB3B584).

:::{note}
If you manage the coordinator's direct TLS implementation, monitor the CPU
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
</scm>

<properties>
<project.build.targetJdk>22</project.build.targetJdk>
<project.build.targetJdk>23</project.build.targetJdk>
<!-- for reproducible build support, updated by release plugin -->
<project.build.outputTimestamp>2024-10-16T21:09:18Z</project.build.outputTimestamp>
<!-- TODO remove this property when no module overrides it -->
Expand All @@ -153,7 +153,7 @@
<air.check.skip-spotbugs>true</air.check.skip-spotbugs>
<air.check.skip-pmd>true</air.check.skip-pmd>
<air.check.skip-jacoco>true</air.check.skip-jacoco>
<air.java.version>22.0.0</air.java.version>
<air.java.version>23.0.0</air.java.version>
<air.javadoc.lint>syntax,reference,html,-missing</air.javadoc.lint>
<air.modernizer.java-version>8</air.modernizer.java-version>
<air.release.preparation-goals>clean verify -DskipTests</air.release.preparation-goals>
Expand Down

0 comments on commit c51db6c

Please sign in to comment.