QiangYuan0828 commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169482375
##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/RandomReadQueryLoadBalanceAlgorithm.java:
##########
@@ -29,7 +30,10 @@ public final class RandomReadQueryLoadBalanceAlgorithm
implements ReadQueryLoadB
@Override
public String getDataSource(final String name, final String
writeDataSourceName, final List<String> readDataSourceNames) {
- return
readDataSourceNames.get(ThreadLocalRandom.current().nextInt(readDataSourceNames.size()));
+ Preconditions.checkState(readDataSourceNames.size() > 0, "read data
need at least 1 source.");
Review Comment:
Thanks for your clarification. I have already reverted the first commit. May
I have some suggestions about the commit about `init` in
`WeightReadQueryLoadBalanceAlgorithm`?
--
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]