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

   ## Bug Report
   
   When using the following configuration, the value passed to 
[rule.findDataSourceGroupRule(logicDataSourceName)](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingSQLRouter.java#L47)
 is write_ds or read_ds_0, which fails to locate the correct dataSourceGroups 
(e.g., joshua in the configuration). This causes the ReadwriteSplitting logic 
to be skipped. This PR fixes the issue by ensuring the logicDataSourceName 
parameter passed is set to joshua.
   
   ```
   mode:
     type: Standalone
     repository:
       type: JDBC
   
   dataSources:
     write_ds:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       url: jdbc:postgresql://127.0.0.1:5432/mydatabase
       username: myuser
       password: secret
     read_ds_0:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       url: jdbc:postgresql://127.0.0.1:5432/mydatabase
       username: myuser
       password: secret
       readOnly: true
   
   rules:
     - !READWRITE_SPLITTING
       dataSourceGroups:
         "joshua":
           writeDataSourceName: write_ds
           readDataSourceNames:
             - read_ds_0
           transactionalReadQueryStrategy: PRIMARY
           loadBalancerName: baseAA
       loadBalancers:
         baseAA: # Load balance algorithm name
           type: ROUND_ROBIN
     - !SINGLE
       tables:
         - "*.*.*"
   
   props:
     sql-show: true
   ```
   
   
   ### Which version of ShardingSphere did you use?
   
   5.5.0/5.5.1 triggers BUG
   5.4.1 works normally
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   Tableless write operations have transactions
   Tableless write operations point to write_ds
   
   ### Actual behavior
   Tableless write operations have transactions
   Tableless write operations do not always point to write_ds, but sometimes 
point to read_ds_0
   
   ### Reason analyze (If you can)
   https://github.com/apache/shardingsphere/pull/34340
   
   


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