You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:33:43 UTC

[GitHub] [shardingsphere] FlyingZC opened a new issue, #19891: When all read data sources are disabled by distsql,`RandomReadQueryLoadBalanceAlgorithm` reports exception

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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #19891: When all read data sources are disabled by distsql,`RandomReadQueryLoadBalanceAlgorithm` reports exception

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #19891:
URL: https://github.com/apache/shardingsphere/issues/19891#issuecomment-1272349076

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] FlyingZC commented on issue #19891: When all read data sources are disabled by distsql,`RandomReadQueryLoadBalanceAlgorithm` reports exception

Posted by GitBox <gi...@apache.org>.
FlyingZC commented on issue #19891:
URL: https://github.com/apache/shardingsphere/issues/19891#issuecomment-1206099902

   server.yaml
   ```yaml
   mode:
     type: Cluster
     repository:
       type: ZooKeeper
       props:
         namespace: governance_ds
         server-lists: localhost:2181
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
         maxRetries: 3
         operationTimeoutMilliseconds: 500
     overwrite: true
   
   rules:
     - !AUTHORITY
       users:
         - root@%:root
         - sharding@:sharding
       provider:
         type: ALL_PERMITTED
     - !TRANSACTION
       defaultType: XA
       providerType: Atomikos
     - !SQL_PARSER
       sqlCommentParseEnabled: true
       sqlStatementCache:
         initialCapacity: 2000
         maximumSize: 65535
       parseTreeCache:
         initialCapacity: 128
         maximumSize: 1024
   ```
   
   config-readwrite-splitting.yaml
   ```yaml
   databaseName: readwrite_splitting_db
   
   dataSources:
     write_ds:
       url: jdbc:mysql://127.0.0.1:3306/demo_write_ds?serverTimezone=UTC&useSSL=false
       username: root
       password: 1
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     read_ds_0:
       url: jdbc:mysql://127.0.0.1:3306/demo_read_ds_0?serverTimezone=UTC&useSSL=false
       username: root
       password: 1
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     read_ds_1:
       url: jdbc:mysql://127.0.0.1:3306/demo_read_ds_1?serverTimezone=UTC&useSSL=false
       username: root
       password: 1
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !READWRITE_SPLITTING
     dataSources:
       readwrite_ds:
         staticStrategy:
           writeDataSourceName: write_ds
           readDataSourceNames:
             - read_ds_0
             - read_ds_1
         loadBalancerName: random
     loadBalancers:
       random:
         type: RANDOM
   ```


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] closed issue #19891: When all read data sources are disabled by distsql,`RandomReadQueryLoadBalanceAlgorithm` reports exception

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #19891: When all read data sources are disabled by distsql,`RandomReadQueryLoadBalanceAlgorithm` reports exception 
URL: https://github.com/apache/shardingsphere/issues/19891


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org