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 connecting to OpenGauss via DistSQL in Proxy Native #33139

Closed
wants to merge 1 commit into from

Conversation

linghengqian
Copy link
Member

@linghengqian linghengqian commented Oct 7, 2024

For #29052.

Changes proposed in this pull request:

  • Support connecting to OpenGauss via DistSQL in Proxy Native.

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.

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.

  • 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)
       [...]

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.

Wait for me to raise a separate PR to introduce the SCM proposal on GraalVM CE For JDK22.

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.

  • 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)
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)
       [...]

@linghengqian linghengqian force-pushed the opengauss branch 3 times, most recently from 09468e8 to 6ef6240 Compare October 14, 2024 05:12
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.

  • Close this PR until I fix the bug on GraalVM CE.

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.

1 participant