Skip to content

Commit 047c4ec

Browse files
committed
Require JDK 21 to run Trino
1 parent 7037df7 commit 047c4ec

File tree

12 files changed

+22
-66
lines changed

12 files changed

+22
-66
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
fail-fast: false
5858
matrix:
5959
java-version:
60-
- 17 # Keep testing on JDK 17 to ensure basic backward compatibility
6160
- 21
6261
timeout-minutes: 45
6362
steps:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ information about reporting vulnerabilities.
3434
## Build requirements
3535

3636
* Mac OS X or Linux
37-
* Java 17.0.5+, 64-bit
37+
* Java 21.0.1+, 64-bit
3838
* Docker
3939
* Turn SELinux or other systems disabling write access to the local checkout
4040
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
7070
properly configured for the project:
7171

7272
* Open the File menu and select Project Structure
73-
* In the SDKs section, ensure that JDK 17 is selected (create one if none exist)
74-
* In the Project section, ensure the Project language level is set to 17
73+
* In the SDKs section, ensure that JDK 21 is selected (create one if none exist)
74+
* In the Project section, ensure the Project language level is set to 21
7575

7676
### Running a testing server
7777

core/trino-main/src/main/java/io/trino/dispatcher/DecoratingListeningExecutorService.java

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,23 @@
1616
import com.google.common.util.concurrent.ForwardingListeningExecutorService;
1717
import com.google.common.util.concurrent.ListenableFuture;
1818
import com.google.common.util.concurrent.ListeningExecutorService;
19-
import jakarta.annotation.Nullable;
2019

21-
import java.lang.invoke.MethodHandle;
22-
import java.lang.reflect.Method;
2320
import java.time.Duration;
2421
import java.util.Collection;
2522
import java.util.List;
2623
import java.util.concurrent.Callable;
2724
import java.util.concurrent.ExecutionException;
28-
import java.util.concurrent.ExecutorService;
2925
import java.util.concurrent.Future;
3026
import java.util.concurrent.TimeUnit;
3127
import java.util.concurrent.TimeoutException;
3228

33-
import static com.google.common.base.Throwables.throwIfUnchecked;
3429
import static com.google.common.collect.ImmutableList.toImmutableList;
35-
import static io.trino.util.Reflection.methodHandle;
3630
import static java.util.Objects.requireNonNull;
3731

3832
public class DecoratingListeningExecutorService
3933
extends ForwardingListeningExecutorService
4034
implements ListeningExecutorService
4135
{
42-
// TODO remove after requiring Java 19+ for runtime.
43-
private static final @Nullable MethodHandle CLOSE_METHOD;
44-
45-
static {
46-
Method closeMethod;
47-
try {
48-
closeMethod = ExecutorService.class.getMethod("close");
49-
}
50-
catch (NoSuchMethodException e) {
51-
closeMethod = null;
52-
}
53-
CLOSE_METHOD = closeMethod != null
54-
? methodHandle(closeMethod)
55-
: null;
56-
}
57-
5836
private final ListeningExecutorService delegate;
5937
private final TaskDecorator decorator;
6038

@@ -194,21 +172,10 @@ public boolean awaitTermination(Duration duration)
194172
return super.awaitTermination(duration);
195173
}
196174

197-
// TODO This is temporary, until Guava's ForwardingExecutorService has the method in their interface. See https://github.com/google/guava/issues/6296
198-
//@Override
175+
@Override
199176
public void close()
200177
{
201-
if (CLOSE_METHOD == null) {
202-
throw new UnsupportedOperationException("ExecutorService.close has close() method since Java 19. " +
203-
"The DecoratingListeningExecutorService supports the method only when run with Java 19 runtime.");
204-
}
205-
try {
206-
CLOSE_METHOD.invoke(delegate());
207-
}
208-
catch (Throwable e) {
209-
throwIfUnchecked(e);
210-
throw new RuntimeException(e);
211-
}
178+
delegate.close();
212179
}
213180

214181
public interface TaskDecorator

core/trino-main/src/main/java/io/trino/server/TrinoSystemRequirements.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ else if ("Mac OS X".equals(osName)) {
9494

9595
private static void verifyJavaVersion()
9696
{
97-
Version required = Version.parse("17.0.5");
97+
Version required = Version.parse("21.0.1");
9898

9999
if (Runtime.version().compareTo(required) < 0) {
100100
failRequirement("Trino requires Java %s at minimum (found %s)", required, Runtime.version());

core/trino-server-main/src/main/java/io/trino/server/TrinoServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public static void main(String[] args)
2929
String javaVersion = nullToEmpty(StandardSystemProperty.JAVA_VERSION.value());
3030
String majorVersion = javaVersion.split("\\D", 2)[0];
3131
Integer major = Ints.tryParse(majorVersion);
32-
if (major == null || major < 17) {
33-
System.err.println(format("ERROR: Trino requires Java 17+ (found %s)", javaVersion));
32+
if (major == null || major < 21) {
33+
System.err.println(format("ERROR: Trino requires Java 21+ (found %s)", javaVersion));
3434
System.exit(100);
3535
}
3636

core/trino-server-rpm/src/main/rpm/preinstall

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ check_if_correct_java_version() {
2222
# candidate for JAVA_HOME).
2323
JAVA_VERSION=$(java_version "$1")
2424
JAVA_MAJOR=$(echo "$JAVA_VERSION" | cut -d'.' -f1)
25-
if [ "$JAVA_MAJOR" -ge "17" ]; then
25+
if [ "$JAVA_MAJOR" -ge "21" ]; then
2626
echo "$1" >/tmp/trino-rpm-install-java-home
2727
return 0
2828
else
@@ -34,10 +34,6 @@ check_if_correct_java_version() {
3434
if ! check_if_correct_java_version "$JAVA_HOME"; then
3535
java_found=false
3636
for candidate in \
37-
/usr/lib/jvm/java-17-* \
38-
/usr/lib/jvm/zulu-17 \
39-
/usr/lib/jvm/temurin-17 \
40-
/usr/lib/jvm/temurin-17-* \
4137
/usr/lib/jvm/java-21-* \
4238
/usr/lib/jvm/zulu-21 \
4339
/usr/lib/jvm/temurin-21 \
@@ -61,7 +57,7 @@ if [ "$java_found" = false ]; then
6157
+======================================================================+
6258
| Error: Required Java version could not be found |
6359
+----------------------------------------------------------------------+
64-
| JDK 17 was not detected. |
60+
| JDK 21 was not detected. |
6561
| Recommended JDK distribution is Eclipse Temurin. |
6662
| Installation guide: https://adoptium.net/installation/linux/ |
6763
| |

core/trino-server-rpm/src/test/java/io/trino/server/rpm/ServerIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public ServerIT()
5656
@Test
5757
public void testInstall()
5858
{
59-
testInstall("17");
6059
testInstall("21");
6160
}
6261

@@ -107,7 +106,6 @@ private void testInstall(String javaVersion)
107106
public void testUninstall()
108107
throws Exception
109108
{
110-
testUninstall("17");
111109
testUninstall("21");
112110
}
113111

docs/src/main/sphinx/functions/conversion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Like {func}`cast`, but returns null if the cast fails.
2222
## Formatting
2323

2424
:::{function} format(format, args...) -> varchar
25-
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)
25+
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)
2626
and arguments:
2727

2828
```

docs/src/main/sphinx/functions/regexp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,6 @@ SELECT regexp_split('1a 2b 14m', '\s*[a-z]+\s*'); -- [1, 2, 14, ]
184184
```
185185
:::
186186

187-
[capturing group number]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html#gnumber
188-
[capturing groups]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html#cg
189-
[java pattern]: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html
187+
[capturing group number]: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html#gnumber
188+
[capturing groups]: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html#cg
189+
[java pattern]: https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html

docs/src/main/sphinx/installation/deployment.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,15 @@
3535

3636
### Java runtime environment
3737

38-
Trino requires a 64-bit version of Java 17, with a minimum required version of 17.0.5.
39-
Earlier major versions such as Java 8 or Java 11 do not work.
40-
Newer major versions such as Java 18 or 19, are not supported -- they may work, but are not tested.
38+
Trino requires a 64-bit version of Java 21, with a minimum required version of 21.0.1.
39+
Earlier major versions such as Java 8, Java 11 or Java 17 do not work.
40+
Newer major versions such as Java 22 are not supported -- they may work, but are not tested.
4141

4242
We recommend using the Eclipse Temurin OpenJDK distribution from
4343
[Adoptium](https://adoptium.net/) as the JDK for Trino, as Trino is tested
4444
against that distribution. Eclipse Temurin is also the JDK used by the [Trino
4545
Docker image](https://hub.docker.com/r/trinodb/trino).
4646

47-
If you are using Java 17 or 18, the JVM must be configured to use UTF-8 as the default charset by
48-
adding `-Dfile.encoding=UTF-8` to `etc/jvm.config`. Starting with Java 19, the Java default
49-
charset is UTF-8, so this configuration is not needed.
50-
5147
(requirements-python)=
5248

5349
### Python

0 commit comments

Comments
 (0)