dyrnq opened a new issue, #28928:
URL: https://github.com/apache/shardingsphere/issues/28928

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore 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?
   
    5.4.1 
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   write use ds_1 AND read use ds_2
   
   ### Actual behavior
   
   write use ds_1 or ds2  AND read use ds_1 or ds_2
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   > application.yaml
   ```bash
   server:
     port: 8080
   spring:
     datasource:
       driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
       url: jdbc:shardingsphere:classpath:xxx.yaml
   
   logging:
     level:
       root: INFO
   mybatis-plus:
     configuration:
       # MyBatis 配置项,可以根据需要进行配置
       cache-enabled: true
       map-underscore-to-camel-case: true
   #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
       # 其他 MyBatis 配置项...
   ```
   
   >xxx.yaml
   
   ```bash
   props:
     sql-show: true
     sql-simple: false
   dataSources:
     ds_1:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.cj.jdbc.Driver
       jdbcUrl: 
jdbc:mysql://192.168.1.130:4406/mydb?useUnicode=true&characterEncoding=utf8&useSSL=false
       username: root
       password: opening
     ds_2:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.cj.jdbc.Driver
       jdbcUrl: 
jdbc:mysql://192.168.1.130:5506/mydb?useUnicode=true&characterEncoding=utf8&useSSL=false
       username: root
       password: opening
   
   
   rules:
     - !READWRITE_SPLITTING
       dataSources:
         readwrite_ds:
           writeDataSourceName: ds_1
           readDataSourceNames:
             - ds_2
           transactionalReadQueryStrategy: DYNAMIC
           loadBalancerName: random
       loadBalancers:
         random:
           type: ROUND_ROBIN
     - !BROADCAST
       tables:
         - loudong
   
   ```
   
   > log
   ```bash
   2023-11-03 15:36:43.951  INFO 486703 --- [  restartedMain] 
com.example.SQLTest.SqlTestApplication   : Started SqlTestApplication in 17.11 
seconds (JVM running for 18.503)
   2023-11-03 15:37:14.479  INFO 486703 --- [qtp493760912-26] 
ShardingSphere-SQL                       : Logic SQL: INSERT INTO loudong  ( id,
   city,
   region,
   name,
   ld_num,
   unit_num )  VALUES  ( ?,
   ?,
   ?,
   ?,
   ?,
   ? )
   2023-11-03 15:37:14.479  INFO 486703 --- [qtp493760912-26] 
ShardingSphere-SQL                       : Actual SQL: ds_2 ::: INSERT INTO 
loudong  ( id,
   city,
   region,
   name,
   ld_num,
   unit_num )  VALUES  ( ?,
   ?,
   ?,
   ?,
   ?,
   ? ) ::: [2cb4616e-6649-4d56-9, 北京, 通州, ???, 11, 22]
   2023-11-03 15:37:14.480  INFO 486703 --- [qtp493760912-26] 
ShardingSphere-SQL                       : Actual SQL: ds_1 ::: INSERT INTO 
loudong  ( id,
   city,
   region,
   name,
   ld_num,
   unit_num )  VALUES  ( ?,
   ?,
   ?,
   ?,
   ?,
   ? ) ::: [2cb4616e-6649-4d56-9, 北京, 通州, ???, 11, 22]
   2023-11-03 15:37:45.663  INFO 486703 --- [qtp493760912-22] 
ShardingSphere-SQL                       : Logic SQL: SELECT COUNT(*) FROM 
loudong
   2023-11-03 15:37:45.663  INFO 486703 --- [qtp493760912-22] 
ShardingSphere-SQL                       : Actual SQL: ds_1 ::: SELECT COUNT(*) 
FROM loudong
   2023-11-03 15:37:45.885  INFO 486703 --- [qtp493760912-22] 
ShardingSphere-SQL                       : Logic SQL: SELECT  
id,city,region,name,ld_num,unit_num  FROM loudong LIMIT ?
   2023-11-03 15:37:45.885  INFO 486703 --- [qtp493760912-22] 
ShardingSphere-SQL                       : Actual SQL: ds_2 ::: SELECT  
id,city,region,name,ld_num,unit_num  FROM loudong LIMIT ? ::: [10]
   
   ```
   
   ### 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]

Reply via email to