Skip to content

Java 17 and Jetty 12 upgrade#24866

Merged
ZacBlanco merged 27 commits into
prestodb:masterfrom
ZacBlanco:jetty-upgrade
Aug 13, 2025
Merged

Java 17 and Jetty 12 upgrade#24866
ZacBlanco merged 27 commits into
prestodb:masterfrom
ZacBlanco:jetty-upgrade

Conversation

@ZacBlanco

@ZacBlanco ZacBlanco commented Apr 4, 2025

Copy link
Copy Markdown
Contributor

Description

This change brings in the latest dependencies for airbase, airlift, drift, discovery-server, airline, and units. The latest airlift utilizes Jetty 12. In order to perform this upgrade in Presto we need to move a lot of dependencies from javax to jakarta namespace since Jetty 12 uses those dependencies. This necessitated a large migration across the codebase. There aren't too many complicated changes here other than some test fixes due to the upgrades. Mostly it is renaming and re-organizing imports.

Modules which rely on jetty through the airlift HTTP server and HTTP client dependencies have been updated to compile to Java 17 bytecode through the the property <project.build.targetJdk> in each modules' respective pom.xml files. Client-facing dependencies have been kept on Java 8 bytecode such as presto-common, presto-spi, presto-client, and presto-jdbc. Using Java 17 bytecode means that Java 17 is now required to build and run Presto after this PR is merged.

See this document for details about upgrading Presto deployments after this change has been merged

Motivation and Context

Jetty 12 has performance enhancements over our previous Jetty 9.X line and resolves many security vulnerabilities. It also helps modernize Presto and bring it closer to the most recent Java versions.

Impact

  • Java 17 is now required by developers in order to compile Presto
  • Java 17 is now required to run Presto
  • Connectors may continue to compile at Java 8 bytecode level, but will execute using a Java 17 VM.
  • JVM --add-opens arguments need to be added to users' jvm.config files

Test Plan

  1. Existing tests
  2. We've performed a number of TPC-DS SF1K performance benchmarks using this build and have not seen any regressions in query execution times.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== RELEASE NOTES ==

General Changes
* Upgrade Presto to require Java 17. The Presto client and Presto-on-Spark remain Java 8-compatible. Presto now requires a Java 17 VM to run both coordinator and workers.
* Upgrade airlift to 0.221
* Upgrade Jetty webserver to 12
* Upgrade guice to 6.0

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Apr 4, 2025
@ZacBlanco ZacBlanco force-pushed the jetty-upgrade branch 3 times, most recently from 75ec372 to 2cd9557 Compare April 9, 2025 22:24
@ZacBlanco ZacBlanco force-pushed the jetty-upgrade branch 4 times, most recently from c514a3e to 363b4c5 Compare April 17, 2025 21:58
@prestodb-ci

Copy link
Copy Markdown
Contributor

@ethanyzhang imported this issue into IBM GitHub Enterprise

@ZacBlanco ZacBlanco force-pushed the jetty-upgrade branch 3 times, most recently from 129bef4 to 621b86d Compare April 29, 2025 18:14
@ZacBlanco ZacBlanco marked this pull request as ready for review April 29, 2025 18:33
@ZacBlanco ZacBlanco requested a review from czentgr as a code owner April 29, 2025 18:33
@prestodb-ci prestodb-ci requested a review from a team April 29, 2025 18:33
@ZacBlanco ZacBlanco requested a review from a team as a code owner April 29, 2025 18:33
@prestodb-ci prestodb-ci requested review from anandamideShakyan and pratyakshsharma and removed request for a team April 29, 2025 18:33
ZacBlanco and others added 21 commits August 12, 2025 13:38
This could be done in a single file, but by splitting this up it
will allows contributors and maintainers to incrementally re-
enable the modernizer on each module since it will cause lots of
code change. It will also introduce lots of opportunities for new
contributors to get involved with Presto.
- Spark requires certain versions of jersey, javax.rs.ws-api and
javax.serlet-api in order to run. This change ensures that we use
the correct library versions at runtime. The versions chosen
correspond to those used in Spark 2.4.4 which is the spark version
inside of Presto's spark-core dependency
- Use java 17 bytecode for PoS integration tests
This change expands the OVERRIDE_JDK_DIR environment
configuration to the tempto runner in addition to the existing
behavior for the presto coordinator and workers inside of the
product tests suite. run_tempto.sh was updated to detect the
overridden jdk volume when executing in order to make the
tests run on a compatible JDK since product tests compiles
to java 17 bytecode by default
This makes URI compliance checks in the REST catalog server
more lax during tests in order to comply with the request URIs
generated by the Iceberg rest catalog spec
Due to plugin and dependency updates, some modules' surefire
execution picks up a junit runner instead of the testng one.

This changes forces the use of testng in all presto modules.
presto-testing-mysql still depends on io.airlift:units instead of
com.facebook.airlift:units. This causes issues for the tests which
set MySqlOptions since the builder type only accepts units. Rather than
include the io.airlift:units dependency, this commit removes the use of
the builder options which accept a Duration type in order to allow the
project to compile.

This commit can be reverted if we release a new version of
presto-testing-mysql with the new com.facebook.airlift:units dependency.
Airlift's HttpUriBuilder expects that uris passed to it are
not yet encoded. However, because we use a semicolon ';' to
delimit function names and parameters in the function server
the semicolon which is encoded to %3B gets double-encoded to
%253B by the URI builder (% encodes to %25). Older versions
of Jetty allow this sequence in the URI. Newer servers however
reject this request encoded with %25xxx with an
error stating "AMBIGUOUS_PATH_PARAMETER".

If we avoid using the HttpUriBuilder, we don't double-encode
the semicolon, and the requests will work against the new
server
- remove airline from classpath by excluding it from com.teradata.tpcds:tpcds
- force presto-product-tests to shade airline by disabling
the generation of the dependency-reduced-pom
- change message() to body() in StatementClient to get correct error messages
downgrade guice to 6.0.0 for Java 8 compat
Downgrade guice to 6.0.0. replace all jakarta.inject.Provider with
javax.inject.Provider. Update airlift version to one with guice 6.0.0.
This makes it easier to integrate libraries that use javax with Presto.
This diff contains multiple changes that go together
1. We remove the dependency on presto-main module as it is targetted to compile
   for JDK17 but presto-on-spark* modules compile to JDK8/11.
2. Removing dependency on presto-main means that we have to figure out a solution
   to provide the missing functionality on which we depended. The only way to
   to do this is to duplicate the necessary classes and their dependencies
3. Next, we now have to override http-client,http-server and discovery to be
   compatible with JDK8/11. For this we pin the airlift version to 0.216 and the
   corresponding jetty version to 9.8.45.vXXXXX
4. Next we still need to do some amount of migration of classes as we moved from
   using javax -> jakarta and from io.airlift to com.facebook.airlift. Note that
   because for some of the airlift jars we still use 0.216 so it expects old
   io.airlift classes. So we retain both io.airlift and com.facebook.airlift
5. To manage the duplication we also exclude some classes from duplicate class check
   as the signature of the classes is the same
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.