Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running DistSQL under Proxy Native in the form of GraalVM Native Image #33095

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

linghengqian
Copy link
Member

@linghengqian linghengqian commented Oct 2, 2024

For #29052.

Changes proposed in this pull request:

  • Support running DistSQL under Proxy Native in the form of GraalVM Native Image.
  • In order to directly collect the GraalVM Reachability Metadata of ShardingSphere Proxy through unit testing, we must directly start ShardingSphere Proxy without using the Docker Image.
  • The most embarrassing part is that ShardingSphere Proxy cannot actually connect to H2database, which requires starting a MySQL container.
  • The most awkward part of this PR is the splicing of DistSQL in org.apache.shardingsphere.test.natived.proxy.features.ShardingTest. Since we need to use the MySQL port of the MySQL container obtained from the testcontainers-java API, we always need to manually splice DistSQL instead of directly reading the .sql file. But the problem is that JDK8 does not have the concept of multi-line strings, which makes the related unit tests quite difficult to maintain. Maybe there is a way to write these unit tests under JDK 21.
  • java.util.LinkedHashSet is a magical exception. Running ShardingSphere Proxy under GraalVM Native Image requires its constructor. Add it to extra-filter.json.

Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.

@linghengqian linghengqian force-pushed the fix-proxy-native branch 3 times, most recently from bffa8c0 to ae27488 Compare October 2, 2024 04:17
@linghengqian linghengqian force-pushed the fix-proxy-native branch 4 times, most recently from d4c098a to d2d325c Compare October 2, 2024 13:36
@linghengqian linghengqian changed the title Let ShardingSphere Proxy Native be able to start and be used normally Guarantee ShardingSphere Proxy Native starts and functions correctly Oct 2, 2024
@linghengqian linghengqian force-pushed the fix-proxy-native branch 2 times, most recently from ca235a2 to 5c4e1f3 Compare October 2, 2024 18:46
@linghengqian linghengqian changed the title Guarantee ShardingSphere Proxy Native starts and functions correctly Support running DistSQL under Proxy Native in the form of GraalVM Native Image Oct 2, 2024
Copy link
Member Author

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

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

  • The focus of the current PR is a bit complicated, so it is necessary to temporarily split some irrelevant parts.

@linghengqian linghengqian marked this pull request as ready for review October 2, 2024 19:42
@taojintianxia taojintianxia merged commit 345e317 into apache:master Oct 3, 2024
142 checks passed
@linghengqian linghengqian deleted the fix-proxy-native branch October 3, 2024 01:25
@linghengqian linghengqian added this to the 5.5.1 milestone Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants