trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.47k stars 3.01k forks source link

Use and require Java 22 #20980

Closed mosabua closed 6 months ago

mosabua commented 8 months ago

This issues aims to detail and track the progress towards adopting Java 22 as build and runtime requirement for Trino.

Background and motivation

Trino completely adopted Java 21 as of Trino 436. See https://trino.io/blog/2023/11/03/java-21 and https://trino.io/docs/current/release/release-436.html. Java 21 is a LTS release of Java.

Java 22 brings considerable improvements and additional APIs that enable further progress in terms of performance work done in Project Hummingbird.

Java 22 is a STS Java release and scheduled to ship in March 2024. Adoption timing in Trino will depend on testing results and feedback, as well as the time for implementation and collaboration with Trino community members.

Specifically, for Java 22, these are some features that we want to be able to leverage:

Implementation

Following steps are roughly in order:

wendigo commented 8 months ago

Related: https://github.com/mojohaus/extra-enforcer-rules/pull/286

wendigo commented 8 months ago

~We also need modernizer 2.8.0 which currently breaks mvnd support.~ With these two plugin changes and some airbase updates, master builds on JDK 22-ea (22.ea.36) with language level 22.

wendigo commented 8 months ago

✅ Related: https://github.com/airlift/airbase/pull/397

wendigo commented 8 months ago

✅ Related: https://github.com/trinodb/trino/pull/20986

wendigo commented 8 months ago

✅ Related: https://github.com/airlift/airbase/pull/402

wendigo commented 8 months ago

✅ Related: https://github.com/trinodb/trino/pull/21155

wendigo commented 8 months ago

https://github.com/trinodb/trino/pull/21161

wendigo commented 8 months ago

✅ Docker switch to 22 along will all the tests: https://github.com/trinodb/trino/pull/21161/files

wendigo commented 7 months ago

Master is switched to 22 in the runtime

wendigo commented 7 months ago

Final piece - require JDK 22 and switch language level to 22: https://github.com/trinodb/trino/pull/21279

wendigo commented 7 months ago

@mosabua first release shipped with JDK 22 in the runtime

mosabua commented 7 months ago

https://trino.io/docs/current/release/release-444.html#docker-image

mosabua commented 6 months ago

21675 is ready to go.

mosabua commented 6 months ago

https://www.linkedin.com/feed/update/urn:li:activity:7191536752916881409

and

https://trinodb.slack.com/archives/CFLB9AMBN/p1714595878079299

mosabua commented 6 months ago

PR is merged. Java 22 will be a requirement for Trino 447 and newer.

wendigo commented 6 months ago

447 was released.

mosabua commented 6 months ago

Copying here for reference and other readers

Questions from @covalesj:

Just a note -- jdk22 is a short term release; depending on that is going to cause issues in some enterprise environments that only stick to LTS versions of java. Only a problem if jdk22 features begin to get baseline, which will result in forcing longish upgrade cycles for enterprise customers.

Answer from @mosabua reprensenting the Trino project:

We are aware of that. However the benefits outweigh these issues. We will continue to stay with the latest Java release going forward. What JDK is used is mostly an implementation detail. Especially in container-based deployments there is no impact. For non-container based deployments users will just have to choose to stay with old Trino and old Java .. or go with new features, more performance, timely security fixes, bug fixes and overall improvements all around.

Also keep in mind that the "support" window for Java release is completely variable between vendors and you can get support for any release. We are using Eclipse Temurin as an open source project for our testing and inclusion in the container.

mosabua commented 6 months ago

Final update on blog post - https://github.com/trinodb/trino.io/pull/658

Announcement for release https://trinodb.slack.com/archives/CFLB9AMBN/p1715275120439609

covalesj commented 6 months ago

Typically an enterprise may have to build their own container images, with any custom connectors built under a enterprise supported JVM and and JDK. Development teams typically don't get a choice for JVM, but a enterprise wide supported version and release cycle. It sounds like in that case, their enterprises would have had to adopted and rolled out base images to support java 22 within 4 weeks of it being launched (and also support STS). It's likely that they have to forego new features in that case, specifically to meet security and compliance standards (eg.. SOX 2, PCI etc.) and will have to wait until a new LTS is available... or they have to to recompile and back out any specific use of java 22 features that break compilation. Which is the route we will be forced to take if we want to upgrade. Typically we stay within 1 month... but in this case, given those restrictions, and the new LTS for an oracle jdk being in 2025... it will be... something more than a year before we could directly use the baseline without maintaining a backport. I am going to guess that Starburst will run into this sooner or later.

mosabua commented 6 months ago

For the Trino project we decided to move forward for the various reasons mentioned earlier and in the blog post announcement from March - https://trino.io/blog/2024/03/13/java-22

The move has been in planning ever since we moved to 21.

Backporting will be something that some might attempt but I have a feeling this is going to get very difficult soon. We plan to use foreign function and memory API and other newer features and this will result in complex and often impossible situations.

Starburst and all vendors have to decide what they want to do themselves, but I would strongly suggest to all of them to just move on and with the times. Users that want to stay with old releases can always do that.