-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
connection disabled when use com.alibaba.druid.pool.DruidDataSource #32765
Comments
It seems to be a MySQL permission issue ? |
In this case, The Exception SQL[insert into test_test.test(name) values('test')] cause normal SQL[select ''] can't work |
|
https://github.com/HuLaLaGa/shardingsphere-test |
Can not support Druid, the connection pool supported list please see: |
|
11:28:57.213 [main] ERROR com.alibaba.druid.pool.DruidDataSource - {dataSource-1} init error
java.sql.SQLException: unknown jdbc driver : jdbc:tc:mysql:5.7.34://test-databases-mysql/the_database&TC_INITSCRIPT=init-schema.sql
at com.alibaba.druid.util.JdbcUtils.getDriverClassName(JdbcUtils.java:545)
at com.alibaba.druid.pool.DruidDataSource.resolveDriver(DruidDataSource.java:1255)
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:885)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1471)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1463)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:83)
at org.apache.shardingsphere.infra.datasource.pool.CatalogSwitchableDataSource.getConnection(CatalogSwitchableDataSource.java:46)
sdk install java 8.0.422-tem
git clone git@github.com:linghengqian/shardingsphere-test.git
cd ./shardingsphere-test/
sdk use java 8.0.422-tem
./mvnw -T 1C clean test IntStream.range(0, 50).forEachOrdered(i -> {
assertDoesNotThrow(() -> JDBC_TEMPLATE.execute("select ''"));
assertDoesNotThrow(() -> JDBC_TEMPLATE.execute("insert into the_table(id) values(1)"));
});
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.55 s -- in com.hulalaga.ShardingSphereTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.956 s
[INFO] Finished at: 2024-09-25T12:06:17+08:00
[INFO] ------------------------------------------------------------------------
|
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.55 s -- in com.hulalaga.ShardingSphereTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.236 s (Wall Clock)
[INFO] Finished at: 2024-09-25T12:25:36+08:00
[INFO] ------------------------------------------------------------------------ |
TableNotExist Exception is not regarded as fatal error by Druid,instead of AccessDenied Exception is regarded as fatal error。And only fatal error can trigger 'connection disabled' Exception。 |
|
|
|
if ((!conn.closed) && !conn.disable) {
conn.disable(error);
requireDiscard = true;
} |
sdk install java 8.0.422-tem
sdk install java 22.0.2-graalce
git clone git@github.com:linghengqian/druid.git -b re-mysql
cd ./druid/
sdk use java 22.0.2-graalce
./mvnw clean install -T1C -DskipTests
cd ../
git clone git@github.com:linghengqian/shardingsphere-test.git -b fail-test
cd ./shardingsphere-test/
sdk use java 8.0.422-tem
./mvnw -T 1C clean test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.44 s -- in com.hulalaga.ShardingSphereTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.278 s (Wall Clock)
[INFO] Finished at: 2024-09-26T00:20:09+08:00
[INFO] ------------------------------------------------------------------------ |
|
Since no druid committer has reviewed the corresponding PR for more than two weeks, I believe this is a bug that is intentionally buried in druid. I will not update the shardingsphere document for the current issue because it will take longer to wait. |
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. |
This is actually 6 known issues on the druid side, no point trying to track it on the shardingsphere side. |
Which version of ShardingSphere did you use?
5.2.1
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
SQL normally run
Actual behavior
SQL throw Exception(connection disabled) when use com.alibaba.druid.pool.DruidDataSource
Reason analyze (If you can)
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Example codes for reproduce this issue (such as a github link).
The text was updated successfully, but these errors were encountered: