sharding-sphere is 4.0.0.M1-SNAPSHOT cann't configure multiple config-sharding files.
The version using sharding-sphere is 4.0.0.M1-SNAPSHOT。 I configure a config-sharding file and the query is ok,but I configure multiple config-sharding files, execute sql query with java code will report an error:
Exception in thread "main" java.sql.SQLException: Unknown exception: null
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2531)
at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1765)
at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3364)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2283)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069)
at com.mysql.jdbc.ConnectionImpl.
@guowdxp Please fill in the template:
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed GitHub issues.
- Read documentation: ShardingSphere Doc.
Please pay attention on issues you submitted, because we maybe need more details. If no response more than 7 days and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
Which project did you use? Sharding-JDBC or Sharding-Proxy?
Expected behavior
Actual behavior
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 version using sharding-sphere is 4.0.0.M1-SNAPSHOT. I use sharding-Proxy.
I configure a config-sharding file and the query is ok,but I configure multiple config-sharding yaml files, execute sql query with java code will report an error:
Exception in thread "main" java.sql.SQLException: Unknown exception: null at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2531) at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1765) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3364) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2283) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:794) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:44) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at com.mysql.jdbc.Util.handleNewInstance(Util.java:389) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) at java.sql.DriverManager.getConnection(DriverManager.java:579) at java.sql.DriverManager.getConnection(DriverManager.java:221) at com.zhongan.dmds.sharding_sphere.QueryTest.main(QueryTest.java:32)
Java code :
public static void main(String[] args) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
String dmdsName = null;
String sql = "select * from bcp_router limit 0,1" ;
Connection conn = DriverManager.getConnection(url, username, password);
PreparedStatement ps = conn.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
if(rs.next()) {
System.out.println(rs.getObject(1));
}
System.out.println("ok");
rs.close();
ps.close();
conn.close();
}
I can't reproduce this error. Please provide more information like: config file name/config file.
first yaml config file :
schemaName: smp_gr_bcp_dev
dataSources:
ds_smp_gr_bcp_dev_0:
url: jdbc:mysql://url:3306/database_00?useSSL=false
username: username
password: password
maxPoolSize: 5
minPoolSize: 2
ds_smp_gr_bcp_dev_1:
url: jdbc:mysql://url:3306/database_01?useSSL=false
username: username
password: password
maxPoolSize: 5
minPoolSize: 2
shardingRule:
tables:
bcp_router:
actualDataNodes: ds_smp_gr_bcp_dev_0.bcp_router_000${0..1},ds_smp_gr_bcp_dev_1.bcp_router_000${2..3}
databaseStrategy:
inline:
shardingColumn: src_id
algorithmExpression: ds_smp_gr_bcp_dev_${(src_id.hashCode().abs() % 4).intdiv(2)}
tableStrategy:
inline:
shardingColumn: src_id
algorithmExpression: bcp_router_${"000" + (src_id.hashCode().abs() % 4)}
defaultDataSourceName: ds_smp_gr_bcp_dev_0
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
second yaml config file :
schemaName: smp_gr_customer_dev
dataSources:
ds_smp_gr_customer_dev_0:
url: jdbc:mysql://url:3306/database_00?useSSL=false
username: username
password: password
maxPoolSize: 5
minPoolSize: 2
ds_smp_gr_customer_dev_1:
url: jdbc:mysql://url:3306/database_01?useSSL=false
username: username
password: password
maxPoolSize: 5
minPoolSize: 2
shardingRule:
tables:
trans_router:
actualDataNodes: ds_smp_gr_customer_dev_0.trans_router_000${0..1},ds_smp_gr_customer_dev_1.trans_router_000${2..3}
databaseStrategy:
inline:
shardingColumn: trans_no
algorithmExpression: ds_smp_gr_customer_dev_${(trans_no.hashCode().abs() % 4).intdiv(2)}
tableStrategy:
inline:
shardingColumn: trans_no
algorithmExpression: trans_router_${"000" + (trans_no.hashCode().abs() % 4)}
defaultDataSourceName: ds_smp_gr_customer_dev_0
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
- You didn't show the config file name. Can you explicitly show them?
- Do you mean each config can work well separately?
- Please set sql.show: true in server.yaml and show me the log.
- first config filename is config-sharding-sompo-dev____smp_gr_bcp_dev.yaml. second config filename is config-sharding-sompo-dev____smp_gr_customer_dev.yaml
- each config can work well separately.
- after setting sql.show: true in server.yaml, the log is as follows:
[INFO ] 16:56:12.895 [nioEventLoopGroup-2-1] i.n.handler.logging.LoggingHandler - [id: 0xf0b3b2e9, L:/0:0:0:0:0:0:0:0:3308] READ: [id: 0x2e621ddf, L:/127.0.0.1:3308 - R:/127.0.0.1:53944]
[INFO ] 16:56:12.897 [nioEventLoopGroup-2-1] i.n.handler.logging.LoggingHandler - [id: 0xf0b3b2e9, L:/0:0:0:0:0:0:0:0:3308] READ COMPLETE
I find that the error message of the client query is not display on the server. Why is this design?
I really can't reproduce it. Can you debug it with break point?
Here are some progress: If I use CLI to connect Sharding-Proxy, will success in any condition. But when I use HikariCP to connect Sharding-Proxy, exception fired no matter how many sharding congfigs there are.
Can you add my QQ ? My QQ : 491799734
I don't login QQ for months, my wechat is 15810310987. I can pull you to wechat group.
Resolved via https://github.com/apache/incubator-shardingsphere/issues/1830.