Skip to content

Upgrade minimum JDK to 17 and migrate JavaX to Jakarta#17859

Open
HTHou wants to merge 11 commits into
masterfrom
codex/jdk17-jakarta-migration
Open

Upgrade minimum JDK to 17 and migrate JavaX to Jakarta#17859
HTHou wants to merge 11 commits into
masterfrom
codex/jdk17-jakarta-migration

Conversation

@HTHou

@HTHou HTHou commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Raise the minimum Java version and build/runtime checks to JDK 17.
  • Upgrade JDK/Jakarta-locked dependencies, including Jetty 12 EE10, Jersey 3, Logback 1.5, ANTLR 4.13, OpenAPI Generator 7, Swagger Jakarta artifacts, and the Jackson Jakarta RS provider.
  • Migrate the REST service/OpenAPI generated surface and Jakarta EE runtime APIs to Jakarta namespaces.
  • Suppress Thrift generated @Generated annotations because the current bundled Thrift 0.14.1 generator does not support jakarta.annotation.Generated.

Notes

  • Apache HttpClient usage in REST examples and integration tests is intentionally left unchanged.
  • JSR-305 annotations such as javax.annotation.Nonnull, javax.annotation.Nullable, and javax.annotation.concurrent remain where used because they are static annotations and do not block the Jakarta runtime migration.
  • The TsFile snapshot bump also adapts the pipe TsFile page readers to use the decoder accessors exposed by the upgraded TsFile reader APIs. This is not part of the Jakarta namespace migration and should be reviewed as a behavior-sensitive TsFile parsing change.

Validation

  • mvn clean package -pl distribution -am -DskipTests
  • mvn compile -pl external-service-impl/rest-openapi,external-service-impl/rest -DskipTests
  • mvn clean compile -pl iotdb-protocol/thrift-commons,iotdb-protocol/thrift-datanode,iotdb-protocol/thrift-confignode,iotdb-protocol/thrift-ainode,iotdb-protocol/thrift-consensus -am -DskipTests
  • mvn compile -pl iotdb-core/node-commons,iotdb-core/calc-commons,iotdb-core/confignode -DskipTests
  • mvn spotless:apply -pl iotdb-core/calc-commons,iotdb-core/node-commons,iotdb-core/confignode,iotdb-core/datanode,external-service-impl/rest -DskipTests
  • mvn spotless:apply -pl integration-test -P with-integration-tests -DskipTests

@HTHou HTHou force-pushed the codex/jdk17-jakarta-migration branch from 09cc234 to ba97eb7 Compare June 8, 2026 04:29
@HTHou HTHou marked this pull request as ready for review June 8, 2026 04:32
@HTHou HTHou force-pushed the codex/jdk17-jakarta-migration branch 2 times, most recently from 76b6645 to 6bc0035 Compare June 8, 2026 04:40
@Caideyipi

Copy link
Copy Markdown
Collaborator

I think this PR needs to regenerate dependencies.json after the REST/Jakarta dependency changes. dependencies.json is used by -Penable-sbom-check via src/main/groovy/checkDependencies.groovy, and the new
est-openapi dependency tree now contains coordinates that are not in the reference list, for example:

  • com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations (while the old jackson-module-jaxb-annotations entry remains)
  • io.github.classgraph:classgraph
  • io.swagger.core.v3:swagger-integration-jakarta
  • jakarta.inject:jakarta.inject-api
  • com.sun.activation:jakarta.activation

Because the check fails on any dependency added by the current build but missing from dependencies.json, release/SBOM validation can fail even if normal compilation passes. Please regenerate dependencies.json from the transformed SBOM and re-check LICENSE-binary for the newly bundled REST/Jakarta dependencies as well.

@HTHou HTHou force-pushed the codex/jdk17-jakarta-migration branch from 6bc0035 to c7b9bf3 Compare June 8, 2026 07:01
@HTHou HTHou force-pushed the codex/jdk17-jakarta-migration branch from c7b9bf3 to ca3df0a Compare June 8, 2026 07:04
@HTHou HTHou force-pushed the codex/jdk17-jakarta-migration branch from 323a1b1 to f80618e Compare June 8, 2026 07:30
@HTHou HTHou changed the title Upgrade minimum JDK to 17 and migrate REST to Jakarta Upgrade minimum JDK to 17 and migrate JavaX to Jakarta Jun 8, 2026
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.82%. Comparing base (07b9cb0) to head (be178c3).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17859      +/-   ##
============================================
+ Coverage     40.68%   40.82%   +0.14%     
+ Complexity     2620      318    -2302     
============================================
  Files          5244     5245       +1     
  Lines        362374   362908     +534     
  Branches      46653    46760     +107     
============================================
+ Hits         147419   148172     +753     
+ Misses       214955   214736     -219     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CritasWang CritasWang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is described as a JDK 17 + JavaX→Jakarta migration, but it also carries a functional behavior change to TsFile time-column decoding that is unrelated to the migration:

  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/AlignedSinglePageWholeChunkReader.java:184
    defaultTimeDecoder → getTimeDecoder(timeChunkHeader.getEncodingType())
  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/SinglePageWholeChunkReader.java:90
    defaultTimeDecoder → getConfiguredTimeDecoder()

Both getTimeDecoder(...) and getConfiguredTimeDecoder() are new APIs that do not exist in the current IoTDB tree — they come from the upgraded TsFile parent class (AbstractChunkReader), which is why this change is coupled to the TsFile version bump in pom.xml:

  • <tsfile.version>2.3.x-SNAPSHOT</tsfile.version>
  • <tsfile.version>2.3.2-260608-SNAPSHOT</tsfile.version>

This looks like a genuine fix (the time decoder was previously hard-coded to the default instead of honoring the actual chunk encoding type), but it has real runtime behavior implications for the pipe TsFile-parsing path and deserves its own review, commit message, and test coverage rather than being hidden inside a 262-file migration diff.

Request: please either

  1. if it must stay, call it out explicitly in the PR description and add/point to tests that exercise the changed decoding path.

@HTHou

HTHou commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @CritasWang, good catch. You are right that this is not a pure namespace migration change.

This adaptation is required by the TsFile snapshot bump that is part of the JDK 17 upgrade path: without updating these call sites to the decoder accessors exposed by the upgraded TsFile reader APIs, this branch cannot compile/pass CI after the TsFile upgrade. Splitting it out into a standalone PR would also be difficult because that standalone change depends on the same TsFile/JDK17 upgrade context.

I have updated the PR description to call this out explicitly. I will keep this change in this PR, but will make sure it is reviewed as a behavior-sensitive TsFile parsing adaptation and add/point to dedicated coverage for the affected time-decoding path.

@HTHou HTHou marked this pull request as draft June 9, 2026 02:02
@HTHou HTHou marked this pull request as ready for review June 9, 2026 02:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR raises Apache IoTDB’s minimum runtime/build JDK baseline to Java 17 and migrates REST/OpenAPI and Jakarta EE runtime-facing APIs from javax.* to jakarta.*, including upgrading key dependencies (Jetty/Jersey/Swagger/OpenAPI generator/Jackson Jakarta providers). It also updates startup/health-check scripts and CI to enforce/assume JDK 17, and includes a TsFile snapshot bump that adjusts pipe TsFile page readers to newer decoder APIs.

Changes:

  • Enforce JDK 17 across build tooling (Maven compiler/enforcer), CI (GitHub Actions/Jenkins), docs, and startup scripts.
  • Migrate REST service + OpenAPI-generated surface to Jakarta (Jetty EE10, Jersey 3, Swagger Jakarta artifacts, Jackson Jakarta RS provider).
  • Update TsFile snapshot and adapt pipe TsFile page reader construction to updated decoder accessors.

Reviewed changes

Copilot reviewed 76 out of 76 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/tools/windows/ops/health_check.bat Updates displayed minimum JDK requirement to 17.
scripts/tools/ops/health_check.sh Updates displayed minimum JDK requirement to 17.
scripts/sbin/windows/start-datanode.bat Enforces JDK 17+ on Windows DataNode startup.
scripts/sbin/windows/start-confignode.bat Enforces JDK 17+ on Windows ConfigNode startup.
scripts/sbin/start-cli.sh Enforces Java 17+ for CLI and adjusts add-opens handling.
scripts/conf/datanode-env.sh Enforces Java 17+ and simplifies GC logging/add-opens setup.
scripts/conf/confignode-env.sh Enforces Java 17+ and simplifies GC logging/add-opens setup.
README.md Updates Java badge and minimum Java requirement to 17.
README_ZH.md Updates Java badge and minimum Java requirement to 17 (Chinese README).
pom.xml Raises compiler/enforcer baseline to 17; upgrades Jakarta/Jetty/Jersey/Swagger/OpenAPI/ANTLR/etc; adjusts import order; updates Thrift generator args.
LICENSE-binary Updates bundled dependency versions to match upgraded stack (Jetty/ANTLR/Logback/Jakarta APIs).
library-udf/pom.xml Raises UDF module compiler level to 17.
Jenkinsfile Switches Jenkins toolchain from JDK 11 to JDK 17.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionWorker.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/mnode/container/CachedMNodeContainer.java Migrates validation annotations import to jakarta.validation while keeping JSR-305 annotations.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/mnode/container/MemMNodeContainer.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/SchemaLogReader.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/FakeCRC32Deserializer.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/PipeEnriched.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/read/TimeSeriesSchemaScanNode.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/read/TimeSeriesCountNode.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/metadata/read/LevelTimeSeriesCountNode.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/DataNodeTableOperatorGenerator.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/unary/InExpression.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/ConfigExecution.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/schedule/task/DriverTaskId.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeDynamicMemoryBlock.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/SinglePageWholeChunkReader.java Adapts TsFile page reader construction to updated time-decoder accessor.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/parser/scan/AlignedSinglePageWholeChunkReader.java Adapts aligned page reader to updated time-decoder accessor.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/PipeInsertionEvent.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/audit/DNAuditLogger.java Migrates validation annotations import to jakarta.validation.
iotdb-core/datanode/pom.xml Raises DataNode module compiler plugin level to 17.
iotdb-core/consensus/pom.xml Raises consensus module compiler level to 17.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/mnode/container/ConfigMNodeContainer.java Migrates validation annotations import to jakarta.validation.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaQuotaStatistics.java Migrates validation annotations import to jakarta.validation.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/externalservice/ShowExternalServiceResp.java Migrates validation annotations import to jakarta.validation.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/cq/ShowCQResp.java Migrates validation annotations import to jakarta.validation.
iotdb-client/jdbc/README.md Updates JDBC client docs to require JDK 17+.
iotdb-client/client-cpp/README.md Updates C++ client Spotless guidance to JDK 17+.
iotdb-client/client-cpp/pom.xml Activates C++ Spotless profile only on JDK 17+.
integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBAlterColumnTypeIT.java Migrates JAX-RS exception import to jakarta.ws.rs.
integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAlterTimeSeriesTypeIT.java Migrates JAX-RS exception import to jakarta.ws.rs.
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSyntaxConventionStringLiteralIT.java Updates expected parser error message after ANTLR upgrade.
integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppBaseConfig.java Migrates validation annotations import to jakarta.validation.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/RestService.java Migrates Jetty servlet integration to Jetty 12 EE10 + Jakarta servlet types; updates Swagger resource package.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v2/impl/RestApiServiceImpl.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v2/impl/GrafanaApiServiceImpl.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v2/handler/QueryDataSetHandler.java Migrates JAX-RS imports; adds datatype propagation in certain response initializations.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v2/handler/FastLastHandler.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v2/handler/ExceptionHandler.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/impl/RestApiServiceImpl.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/impl/GrafanaApiServiceImpl.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/handler/QueryDataSetHandler.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/handler/ExceptionHandler.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/table/v1/impl/RestApiServiceImpl.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/table/v1/handler/QueryDataSetHandler.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/table/v1/handler/ExceptionHandler.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/impl/PingApiServiceImpl.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/handler/AuthorizationHandler.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/filter/BasicSecurityContext.java Migrates JAX-RS imports to jakarta.ws.rs.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/filter/AuthorizationFilter.java Migrates servlet/JAX-RS/filter imports to Jakarta namespaces.
external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/filter/ApiOriginFilter.java Migrates servlet filter API to jakarta.servlet and simplifies interface usage.
external-service-impl/rest/pom.xml Raises compiler level to 17; updates Jetty EE10 servlet dependency and JAXB/activation exclusions.
external-service-impl/rest-openapi/pom.xml Switches to Swagger/Jackson Jakarta artifacts; configures OpenAPI generator for Jersey 3 + Jakarta EE.
external-service-impl/pom.xml Raises external-service-impl reactor compiler level to 17.
external-service-impl/mqtt/pom.xml Raises MQTT module compiler level to 17.
example/pom.xml Raises examples compiler level to 17.
example/pipe-count-point-processor/pom.xml Raises pipe example compiler level to 17.
example/jdbc/pom.xml Raises JDBC example compiler level to 17.
dependencies.json Updates tracked dependency coordinates for Jakarta/Jetty/Swagger/Jackson changes.
CONTRIBUTING.md Updates Spotless/clang-format guidance to JDK 17 baseline.
CLAUDE.md Updates documented Java compilation baseline to 17.
.github/workflows/multi-language-client.yml Ensures JDK 17 is installed for multi-language client workflows.
.github/workflows/daily-ut.yml Updates daily UT workflow to use JDK 17 baseline across OS matrix.
.github/workflows/daily-it.yml Drops Java 8 from daily IT workflow matrix (JDK 17 only).
.github/workflows/compile-check.yml Removes legacy JDK 8 compile-check workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +51 to +55
@REM IoTDB requires JDK 17 or later.
IF %JAVA_VERSION% LSS 17 (
echo IoTDB only supports jdk >= 17, please check your java version.
goto finally
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in be178c3. The DataNode Windows startup script now checks whether JAVA_VERSION is empty before the numeric LSS comparison and exits through finally with a clearer error message.

Comment on lines +49 to +53
@REM IoTDB requires JDK 17 or later.
IF %JAVA_VERSION% LSS 17 (
echo IoTDB only supports jdk >= 17, please check your java version.
goto finally
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in be178c3. The ConfigNode Windows startup script now has the same empty JAVA_VERSION guard before the LSS comparison, so it fails gracefully if the Java version cannot be parsed.

Comment thread dependencies.json Outdated
Comment thread LICENSE-binary
Comment on lines +227 to +232
org.eclipse.jetty:jetty-http:12.0.36
org.eclipse.jetty:jetty-io:12.0.36
org.eclipse.jetty:jetty-security:12.0.36
org.eclipse.jetty:jetty-server:12.0.36
org.eclipse.jetty.ee10:jetty-ee10-servlet:12.0.36
org.eclipse.jetty:jetty-util:12.0.36

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in be178c3. org.eclipse.jetty:jetty-session:12.0.36 has been added to LICENSE-binary alongside the other Jetty 12 artifacts.

@JackieTien97 JackieTien97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the JDK 17/Jakarta migration work. I found two release/runtime issues that should be addressed before merging.

Comment thread LICENSE-binary
@HTHou

HTHou commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@Caideyipi Addressed in be178c3. I removed the duplicate jakarta.xml.bind:jakarta.xml.bind-api entry from dependencies.json and rechecked the REST/Jakarta coordinates raised here: the Swagger/Jackson/ClassGraph/Jakarta Inject entries are represented, while com.sun.activation:jakarta.activation is excluded from the REST fat jar to avoid duplicating Jakarta Activation classes. LICENSE-binary has also been updated for the newly bundled REST/OpenAPI/Jakarta dependencies.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants