FlyingZC opened a new issue, #19891:
URL: https://github.com/apache/shardingsphere/issues/19891
## Bug Report
### Which version of ShardingSphere did you use?
master
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
proxy
### Expected behavior
not report expection
### Actual behavior
throws `java.lang.IllegalArgumentException: bound must be positive`
### Reason analyze (If you can)
```
java.lang.IllegalArgumentException: bound must be positive
at
java.util.concurrent.ThreadLocalRandom.nextInt(ThreadLocalRandom.java:351)
at
org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.RandomReadQueryLoadBalanceAlgorithm.getDataSource(RandomReadQueryLoadBalanceAlgorithm.java:46)
at
org.apache.shardingsphere.readwritesplitting.route.impl.ReadwriteSplittingDataSourceRouter.route(ReadwriteSplittingDataSourceRouter.java:49)
at
org.apache.shardingsphere.readwritesplitting.route.ReadwriteSplittingSQLRouter.decorateRouteContext(ReadwriteSplittingSQLRouter.java:61)
at
org.apache.shardingsphere.readwritesplitting.route.ReadwriteSplittingSQLRouter.decorateRouteContext(ReadwriteSplittingSQLRouter.java:40)
at
org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:59)
at
org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:53)
at
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:57)
at
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:49)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:117)
at
org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:94)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:112)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
```
<img width="933" alt="image"
src="https://user-images.githubusercontent.com/19788130/183016408-1d117181-ff48-4b19-a1e8-fc3ad35d9d55.png">
The param of `ThreadLocalRandom.current().nextInt()` must be a positive
number.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
```sql
mysql> DISABLE READWRITE_SPLITTING READ read_ds_1;
Query OK, 0 rows affected (2 min 32.83 sec)
mysql> DISABLE READWRITE_SPLITTING READ read_ds_0;
Query OK, 0 rows affected (0.06 sec)
mysql> select * from t_order;
ERROR 1997 (C1997): Runtime exception: [bound must be positive]
```
### Example codes for reproduce this issue (such as a github link).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]