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/01/18 06:58:54 UTC

[GitHub] [shardingsphere] zjcnb opened a new issue #14855: Readwrite-splitting weight loadbalance throws IndexOutOfBoundsException when disable one data source.

zjcnb opened a new issue #14855:
URL: https://github.com/apache/shardingsphere/issues/14855


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   `master`
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   `ShardingSphere-Proxy`
   
   ### Expected behavior
   
   disable read_ds_0, read_ds_1 data source can normal operation.
   
   ### Actual behavior
   
   ```
   java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
   	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
   	at java.util.ArrayList.get(ArrayList.java:433)
   	at org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.WeightReplicaLoadBalanceAlgorithm.getDataSourceName(WeightReplicaLoadBalanceAlgorithm.java:60)
   	at org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.WeightReplicaLoadBalanceAlgorithm.getDataSource(WeightReplicaLoadBalanceAlgorithm.java:52)
   	at org.apache.shardingsphere.readwritesplitting.route.impl.ReadwriteSplittingDataSourceRouter.route(ReadwriteSplittingDataSourceRouter.java:48)
   	at org.apache.shardingsphere.readwritesplitting.route.ReadwriteSplittingSQLRouter.createRouteContext(ReadwriteSplittingSQLRouter.java:46)
   	at org.apache.shardingsphere.readwritesplitting.route.ReadwriteSplittingSQLRouter.createRouteContext(ReadwriteSplittingSQLRouter.java:41)
   	at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:73)
   	at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:53)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:54)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:46)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:116)
   	at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:68)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.UnicastDatabaseBackendHandler.execute(UnicastDatabaseBackendHandler.java:78)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:96)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:69)
   	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:748)
   ```
   
   ### Configuration
   
   ```
   schemaName: readwrite_splitting_db
   
   dataSources:
     write_ds:
       url: jdbc:mysql://127.0.0.1:3306/demo_write_ds?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       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: 123456
       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: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
   - !READWRITE_SPLITTING
     dataSources:
       pr_ds:
         type: Static
         props:
           write-data-source-name: write_ds
           read-data-source-names: read_ds_0,read_ds_1
         loadBalancerName: weight_lb
     loadBalancers:
       weight_lb:
         type: WEIGHT
         props:
           read_ds_0: 2
           read_ds_1: 1
   ```
   


-- 
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] menghaoranss closed issue #14855: Readwrite-splitting weight loadbalance throws IndexOutOfBoundsException when disable one data source.

Posted by GitBox <gi...@apache.org>.
menghaoranss closed issue #14855:
URL: https://github.com/apache/shardingsphere/issues/14855


   


-- 
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