Support connecting to OpenGauss via DistSQL in Proxy Native#33139
Closed
linghengqian wants to merge 1 commit intoapache:masterfrom
Closed
Support connecting to OpenGauss via DistSQL in Proxy Native#33139linghengqian wants to merge 1 commit intoapache:masterfrom
linghengqian wants to merge 1 commit intoapache:masterfrom
Conversation
33e9588 to
e1a8efe
Compare
linghengqian
commented
Oct 7, 2024
Member
Author
linghengqian
left a comment
There was a problem hiding this comment.
- It looks like the Opengauss JDBC Driver is looking for javac under the GraalVM Native Image, which is a bit strange.
ClassSource [className = 'org.apache.shardingsphere.test.natived.proxy.databases.OpenGaussTest', filePosition = null]
=> org.opengauss.util.PSQLException: [127.0.0.1:60586/127.0.0.1:43385] ERROR: SQL federation does not support SQL 'select version()'.
More details: java.lang.IllegalStateException: Unable to instantiate java compiler
org.opengauss.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2901)
org.opengauss.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2630)
org.opengauss.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:362)
org.opengauss.core.SetupQueryRunner.run(SetupQueryRunner.java:53)
org.opengauss.core.v3.ConnectionFactoryImpl.queryGaussdbVersion(ConnectionFactoryImpl.java:875)
org.opengauss.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:331)
org.opengauss.core.ConnectionFactory.openConnection(ConnectionFactory.java:53)
org.opengauss.jdbc.PgConnection.<init>(PgConnection.java:256)
org.opengauss.Driver.makeConnection(Driver.java:561)
org.opengauss.Driver.connect(Driver.java:314)
[...]
linghengqian
commented
Oct 7, 2024
Member
Author
linghengqian
left a comment
There was a problem hiding this comment.
Wait for me to raise a separate PR to introduce the SCM proposal on GraalVM CE For JDK22.
6 tasks
linghengqian
commented
Oct 13, 2024
Member
Author
There was a problem hiding this comment.
- SCM helped find the critical classes.
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access class
org.codehaus.janino.CompilerFactory
without it being registered for runtime reflection. Add org.codehaus.janino.CompilerFactory to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
[email protected]/java.lang.ClassLoader.loadClass(ClassLoader.java:121)
org.codehaus.commons.compiler.CompilerFactoryFactory.getCompilerFactory(CompilerFactoryFactory.java:192)
org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(CompilerFactoryFactory.java:101)
org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.compile(JaninoRelMetadataProvider.java:154)- For
getDeclaredClasses(), there is no documentation referring to it, but it is indeed documented in the source code, see https://github.com/oracle/graal/blob/vm-24.0.2/docs/reference-manual/native-image/assets/reflect-config-schema-v1.0.0.json#L96 .
org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively access
org.apache.calcite.rel.metadata.BuiltInMetadata.getDeclaredClasses()
without it being registered for runtime reflection. Add org.apache.calcite.rel.metadata.BuiltInMetadata.getDeclaredClasses() to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
[email protected]/java.lang.Class.getDeclaredClasses(DynamicHub.java:1125)
org.codehaus.janino.ReflectionIClass.getDeclaredIClasses2(ReflectionIClass.java:164)
org.codehaus.janino.IClass.getDeclaredIClasses(IClass.java:412)
org.codehaus.janino.IClass.findMemberType(IClass.java:783)- Although the following GRM has been defined,
{
"condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata"},
"name":"org.apache.calcite.rel.metadata.janino.GeneratedMetadata_CollationHandler"
}- The generated classes are still not found under nativeTest. We may need to wait for shardingsphere to switch to graalvm ce for jdk23. In jdk23, GRM was revolutionized again.
Failures (1):
JUnit Jupiter:OpenGaussTest
ClassSource [className = 'org.apache.shardingsphere.test.natived.proxy.databases.OpenGaussTest', filePosition = null]
=> org.opengauss.util.PSQLException: [127.0.0.1:33216/127.0.0.1:35057] ERROR: SQL federation does not support SQL 'select version()'.
More details: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.calcite.rel.metadata.janino.GeneratedMetadata_CollationHandler
org.opengauss.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2901)
org.opengauss.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2630)
org.opengauss.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:362)
org.opengauss.core.SetupQueryRunner.run(SetupQueryRunner.java:53)
org.opengauss.core.v3.ConnectionFactoryImpl.queryGaussdbVersion(ConnectionFactoryImpl.java:875)
org.opengauss.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:331)
org.opengauss.core.ConnectionFactory.openConnection(ConnectionFactory.java:53)
org.opengauss.jdbc.PgConnection.<init>(PgConnection.java:256)
org.opengauss.Driver.makeConnection(Driver.java:561)
org.opengauss.Driver.connect(Driver.java:314)
[...]09468e8 to
6ef6240
Compare
6ef6240 to
cd91625
Compare
linghengqian
commented
Oct 14, 2024
Member
Author
linghengqian
left a comment
There was a problem hiding this comment.
- Close this PR until I fix the bug on GraalVM CE.
7 tasks
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #29052.
Changes proposed in this pull request:
Before committing this PR, I'm sure that I have checked the following options:
./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.