-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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 HiveServer2 through database connection pools other than HikariCP #33762
Merged
+153
−56
Conversation
This file contains 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
linghengqian
force-pushed
the
hive-server2-ha
branch
9 times, most recently
from
November 22, 2024 12:54
66ea4a1
to
a34600a
Compare
linghengqian
commented
Nov 22, 2024
Comment on lines
+84
to
+86
try (Connection connection = dataSource.getConnection()) { | ||
connection.unwrap(ShardingSphereConnection.class).getContextManager().close(); | ||
} |
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.
- I don't really know if there is an easier way to trigger a call to
org.apache.shardingsphere.transaction.base.seata.at.SeataATShardingSphereTransactionManager#close()
thanjava.sql.Connection.unwrap(ShardingSphereConnection.class).getContextManager().close();
. What do you think?
linghengqian
commented
Nov 22, 2024
Comment on lines
+130
to
+140
try (Connection connection = dataSource.getConnection()) { | ||
Class<?> hiveConnectionClass = Class.forName("org.apache.hive.jdbc.HiveConnection"); | ||
if (connection.isWrapperFor(hiveConnectionClass)) { | ||
Object hiveConnection = connection.unwrap(hiveConnectionClass); | ||
String connectedUrl = (String) hiveConnectionClass.getMethod("getConnectedUrl").invoke(hiveConnection); | ||
return DatabaseTypeFactory.get(connectedUrl); | ||
} | ||
throw new SQLWrapperException(sqlFeatureNotSupportedException); | ||
} catch (final SQLException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException exception) { | ||
throw new RuntimeException(exception); |
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.
- I have opened HIVE-15540: Impl
DatabaseMetaData#getURL()
andDatabaseMetaData#getUserName()
for HiveServer2 JDBC Driver hive#5554 to try to completely end this funny logic. The internal structure of HiveServer2 JDBC Driver is simply a world of Otome mobile game.
…ther than HikariCP
linghengqian
force-pushed
the
hive-server2-ha
branch
from
November 22, 2024 13:46
a34600a
to
a369c05
Compare
strongduanmu
approved these changes
Nov 22, 2024
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:
org.apache.hive.jdbc.HiveConnection#getConnectedUrl()
. This creates an easy access.org.testcontainers.jdbc.ContainerDatabaseDriver
which is part oforg.testcontainers.jdbc.AbstractJDBCDriverTest
.org.apache.shardingsphere.transaction.base.seata.at.SeataATShardingSphereTransactionManager#close()
is never called normally. This leads to a large number of logs in https://github.com/apache/shardingsphere/actions/runs/11953880634/job/33322727601 due to the failure of seata client to close normally. Maybe we can find a simpler way to avoid usingconnection.unwrap(ShardingSphereConnection.class).getContextManager().close();
.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
.