-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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 connecting to OpenGauss via DistSQL in Proxy Native #33139
Conversation
33e9588
to
e1a8efe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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)
[...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait for me to raise a separate PR to introduce the SCM proposal on GraalVM CE For JDK22.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Close this PR until I fix the bug on GraalVM CE.
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
.