Skip to content

Conversation

@n-WN
Copy link

@n-WN n-WN commented Sep 30, 2025

Purpose of the PR

  • Relates to Java 17 migration effort

This PR upgrades Apache TinkerPop from 3.5.1 to 3.7.2 to enable Java 17 compatibility while maintaining Java 11 backward compatibility. TinkerPop 3.7.x is the first series that officially supports Java 17.

Main Changes

  1. Dependency upgrade
  • Bump tinkerpop.version from 3.5.1 to 3.7.2 in hugegraph-server/pom.xml.
  • Align internal version constant: update GREMLIN_VERSION = "3.7.2" in hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java.
  1. API migration (TinkerPop 3.7 breaking changes)
  • Switch predicate interfaces from BiPredicate to PBiPredicate:
    • hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java
    • hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/ConditionP.java
    • hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/TraversalUtil.java
  • Update imports for driver message/types due to package relocation (driver.*util.*):
    • Tokens, RequestMessage, ResponseMessage, ResponseStatusCode
    • Modified files:
      • hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java
      • hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java
  1. Gremlin Server configuration migration
  • Serializer class names updated to 3.7 naming (removed d0 suffix) and package migrated to org.apache.tinkerpop.gremlin.util.ser.*:
    • hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-server.yaml
    • hugegraph-server/hugegraph-dist/src/assembly/static/conf/gremlin-driver-settings.yaml
    • hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote.yaml
    • hugegraph-server/hugegraph-dist/src/assembly/static/conf/remote-objects.yaml
    • Raft test configs:
      • hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft1/gremlin-server.yaml
      • hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft2/gremlin-server.yaml
      • hugegraph-server/hugegraph-dist/src/assembly/travis/conf-raft3/gremlin-server.yaml
  • Docker multi-server cluster configs (server1/2/3) updated for consistency:
    • docker/configs/server1-conf/*
    • docker/configs/server2-conf/*
    • docker/configs/server3-conf/*
  1. Test dependency cleanup (separate commit in this PR)
  • Remove unused org.apache.tinkerpop:gremlin-groovy-test:3.2.11 from hugegraph-server/hugegraph-test/pom.xml to avoid version drift and reduce potential conflicts.

Verifying these changes

  • Already covered by existing tests.
    • Build and unit tests pass on Java 11.
    • Java 17 build/run will be verified in follow-up CI jobs as part of the migration.

Does this PR potentially affect the following parts?

  • Dependencies (TinkerPop 3.5.1 → 3.7.2)
    • Follow-up release task: update/add license info and regenerate known dependencies if required by release process:
      • install-dist/scripts/dependency/regenerate_known_dependencies.sh
  • Modify configurations (Gremlin server/driver YAML files updated)
  • The public API
  • Other affects
  • Nope

Documentation Status

  • Doc - No Need
    • Internal dependency and configuration migration; no user-facing API change.
  • Doc - TODO
  • Doc - Done

Upgrade Apache TinkerPop dependency to 3.7.2 to support Java 17 compatibility
while maintaining Java 11 backward compatibility.

Changes:
- Upgrade tinkerpop.version from 3.5.1 to 3.7.2 in hugegraph-server/pom.xml
- Update BiPredicate to PBiPredicate in query condition implementations
  (Condition.java, ConditionP.java, TraversalUtil.java)
- Fix package relocations: org.apache.tinkerpop.gremlin.driver.* -> org.apache.tinkerpop.gremlin.util.*
- Update serializer class names: GraphSONMessageSerializerV{1,2,3}d0 -> GraphSONMessageSerializerV{1,2,3}
- Migrate all Gremlin server and driver configuration files

This upgrade addresses the main blocking issue for Java 17 migration.
This commit fixes the remaining issues found after the initial TinkerPop 3.7.2 upgrade:

1. Update CoreVersion.GREMLIN_VERSION constant from "3.5.1" to "3.7.2"
   - Fixes version API returning incorrect Gremlin version
   - Located in hugegraph-server/hugegraph-core/.../CoreVersion.java

2. Update Docker multi-node deployment configurations (12 files)
   - Fix package path: org.apache.tinkerpop.gremlin.driver.ser.* -> org.apache.tinkerpop.gremlin.util.ser.*
   - Remove deprecated "d0" suffix: GraphSONMessageSerializerV{1,2,3}d0 -> GraphSONMessageSerializerV{1,2,3}
   - Affects docker/configs/server{1,2,3}-conf/*.yaml
   - Required for Docker Compose multi-server cluster deployment

These files were missed in the initial upgrade (commit 44a6c3a) but are now
required for complete TinkerPop 3.7.2 compatibility across all deployment scenarios.
Remove gremlin-groovy-test 3.2.11 from test dependencies. This module was
officially deprecated in TinkerPop 3.2.4 and removed in 3.3.0 (March 2017).
The test functionality has been consolidated into gremlin-test module.

Verified that:
- No code references to gremlin-groovy-test in the codebase
- Project compiles successfully without this dependency
- TinkerPop 3.7.2 does not provide gremlin-groovy-test

References:
- TinkerPop 3.3.0 Upgrade Guide: https://tinkerpop.apache.org/docs/3.3.0/upgrade/
- JIRA TINKERPOP-1612: https://issues.apache.org/jira/browse/TINKERPOP-1612
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. dependencies Incompatible dependencies of package gremlin TinkerPop gremlin labels Sep 30, 2025
@n-WN
Copy link
Author

n-WN commented Oct 1, 2025

    [INFO]
    [INFO] Results:
    [INFO]
    [WARNING] Tests run: 736, Failures: 0, Errors: 0, Skipped: 86
    [INFO]
    [INFO]
    [INFO] --- jacoco:0.8.8:report-aggregate (post-test) @ hugegraph-test ---
    [INFO] Loading execution data file /home/developer/ospp/incubator-hugegraph/hugegraph-server/hugegraph-test/target/jacoco.exec
    [INFO] Analyzed bundle 'hugegraph-core' with 679 classes
    [INFO] Analyzed bundle 'hugegraph-api' with 198 classes
    [INFO] Analyzed bundle 'hugegraph-cassandra' with 43 classes
    [INFO] Analyzed bundle 'hugegraph-scylladb' with 13 classes
    [INFO] Analyzed bundle 'hugegraph-rocksdb' with 55 classes
    [INFO] Analyzed bundle 'hugegraph-hbase' with 33 classes
    [INFO] Analyzed bundle 'hugegraph-mysql' with 39 classes
    [INFO] Analyzed bundle 'hugegraph-postgresql' with 28 classes
    [INFO] Analyzed bundle 'hugegraph-dist' with 9 classes
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary for hugegraph 1.5.0:
    [INFO]
    [INFO] hugegraph .......................................... SUCCESS
    [INFO] hugegraph-commons .................................. SUCCESS
    [INFO] hugegraph-common ................................... SUCCESS
    [INFO] hugegraph-pd ....................................... SUCCESS
    [INFO] hg-pd-grpc ......................................... SUCCESS
    [INFO] hg-pd-common ....................................... SUCCESS
    [INFO] hg-pd-client ....................................... SUCCESS
    [INFO] hugegraph-store .................................... SUCCESS
    [INFO] hg-store-common .................................... SUCCESS
    [INFO] hugegraph-server ................................... SUCCESS
    [INFO] hugegraph-core ..................................... SUCCESS
    [INFO] hugegraph-rpc ...................................... SUCCESS
    [INFO] hugegraph-api ...................................... SUCCESS
    [INFO] hugegraph-cassandra ................................ SUCCESS
    [INFO] hugegraph-scylladb ................................. SUCCESS
    [INFO] hugegraph-rocksdb .................................. SUCCESS
    [INFO] hugegraph-mysql .................................... SUCCESS
    [INFO] hugegraph-palo ..................................... SUCCESS
    [INFO] hugegraph-hbase .................................... SUCCESS
    [INFO] hugegraph-postgresql ............................... SUCCESS
    [INFO] hg-store-grpc ...................................... SUCCESS
    [INFO] hg-store-client .................................... SUCCESS
    [INFO] hugegraph-hstore ................................... SUCCESS
    [INFO] hugegraph-dist ..................................... SUCCESS
    [INFO] hugegraph-test ..................................... SUCCESS [03:43 min]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------

pass

@n-WN
Copy link
Author

n-WN commented Oct 1, 2025

Groovy upgraded from 2.5.14 to 4.0.9

hugegraph-server/pom.xml
  └─> tinkerpop.version: 3.5.1 → 3.7.2
      └─> gremlin-groovy:3.7.2
          └─> org.apache.groovy:groovy:4.0.9

@n-WN
Copy link
Author

n-WN commented Oct 1, 2025

Compilation performance (8c16t 32g):

  • Java 11: 120 seconds
  • Java 17: 38 seconds (68% improvement)

Add --add-opens JVM argument to allow reflection access to java.base/java.util
for CollectionFactoryTest. This follows Apache TinkerPop's approach for handling
deep reflection in tests when running on Java 17+.

Issue: CollectionFactoryTest uses Whitebox.getInternalState() to verify internal
capacity of JDK collection classes (ArrayList, HashMap), which requires opening
the java.util module in Java 17 due to strong encapsulation.

Solution: Add argLine with --add-opens java.base/java.util=ALL-UNNAMED to the
unit-test execution in surefire plugin configuration.

Verified:
- Java 17: 398 tests passed, 0 failed
- Java 11: backward compatible (parameter ignored)

Reference: https://github.com/apache/tinkerpop/blob/384e9a730c735cd386812d463c6f6922da847988/pom.xml#L214
@n-WN
Copy link
Author

n-WN commented Oct 2, 2025

Upgraded the Java version, may require documentation changes

@imbajin imbajin requested a review from Copilot October 5, 2025 14:06
Copy link
Contributor

Copilot AI left a comment

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 upgrades Apache TinkerPop from version 3.5.1 to 3.7.2 to enable Java 17 compatibility while maintaining Java 11 backward compatibility. The upgrade involves updating dependencies, migrating APIs due to breaking changes, and updating configuration files.

Key changes include:

  • Dependency version bump from 3.5.1 to 3.7.2 in Maven configuration
  • API migration from BiPredicate to PBiPredicate interfaces and package relocations for driver components
  • Configuration updates for Gremlin server serializers with new class names and package paths
  • Addition of Java 17+ compatibility JVM arguments for testing

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
hugegraph-server/pom.xml Updates TinkerPop version property from 3.5.1 to 3.7.2
hugegraph-server/hugegraph-test/pom.xml Removes unused gremlin-groovy-test dependency and adds Java 17+ JVM args
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/version/CoreVersion.java Updates internal GREMLIN_VERSION constant to match dependency version
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Condition.java Migrates from BiPredicate to PBiPredicate interface
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/optimize/*.java Updates predicate interfaces and imports for TinkerPop 3.7 compatibility
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherClient.java Updates imports for relocated driver message classes
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java Updates imports for relocated driver message and token classes
Multiple YAML config files Updates serializer class names and packages for TinkerPop 3.7 compatibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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

Labels

dependencies Incompatible dependencies of package gremlin TinkerPop gremlin size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant