funky-eyes commented on code in PR #7071:
URL: https://github.com/apache/incubator-seata/pull/7071#discussion_r1895589940
##########
rm-datasource/src/main/java/org/apache/seata/rm/datasource/DataSourceProxy.java:
##########
@@ -210,6 +210,11 @@ public String getDbType() {
@Override
public ConnectionProxy getConnection() throws SQLException {
Connection targetConnection = targetDataSource.getConnection();
+ //如果是读写分离,在用aop设置主库的时候,会走这里,需要重新设置resourceId
+ if (targetConnection!=null) {
+ this.jdbcUrl = targetConnection.getMetaData().getURL();
Review Comment:
> i am not sure this is useful for dynamic data source, but because
targetConnection is the final real connection it use, i think if they use
dynamic data source, it works too。but it need test cases to verify it.
Why is the last connection always considered the correct address? If my
dynamic data source has 3 master databases and 3 replica databases, how do I
get the correct master database address? In this case, wouldn't it solve the
problem to only proxy the master database? There's no need to recognize the
mapping relationship between the master and replica databases.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]