This is an automated email from the ASF dual-hosted git repository.

jimin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new a59a39ac51 bugfix: AT mode support the URL of a PGSQL cluster (#6261)
a59a39ac51 is described below

commit a59a39ac512aaed485c637758822fe4159fd09e7
Author: funkye <[email protected]>
AuthorDate: Tue Jan 16 20:12:07 2024 +0800

    bugfix: AT mode support the URL of a PGSQL cluster (#6261)
---
 changes/en-us/2.x.md                                   |  1 +
 changes/zh-cn/2.x.md                                   |  1 +
 .../java/io/seata/rm/datasource/DataSourceProxy.java   |  3 +++
 .../io/seata/rm/datasource/DataSourceProxyTest.java    | 18 ++++++++++++++++++
 4 files changed, 23 insertions(+)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index b1b114e418..1c9027d04b 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -18,6 +18,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#6143](https://github.com/apache/incubator-seata/pull/6143)] gracefully 
shut down the server
 - [[#6204](https://github.com/apache/incubator-seata/pull/6204)] fix the 
problem that The incorrect configuration needs to be fixed
 - [[#6248](https://github.com/apache/incubator-seata/pull/6248)] fix JDBC 
resultSet, statement, connection closing order
+- [[#6261](https://github.com/apache/incubator-seata/pull/6261)] AT mode 
support the URL of a PGSQL cluster
 - [[#6256](https://github.com/apache/incubator-seata/pull/6256)] fix 
raft-discovery cannot read registry configuration for seata-all sdk
 - [[#6232](https://github.com/apache/incubator-seata/pull/6232)] convert to 
utf8mb4 if mysql column is json type
 
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index ebeec80036..f7ad328585 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -18,6 +18,7 @@
 - [[#6143](https://github.com/apache/incubator-seata/pull/6143)] 修复优雅停机
 - [[#6204](https://github.com/apache/incubator-seata/pull/6204)] 修复错误配置问题
 - [[#6248](https://github.com/apache/incubator-seata/pull/6248)] 修复JDBC 
resultSet, statement, connection关闭顺序
+- [[#6261](https://github.com/apache/incubator-seata/pull/6261)] 
at模式支持pgsql集群模式url
 - [[#6256](https://github.com/apache/incubator-seata/pull/6256)] 修复在seata-all 
sdk下,raft-discovery模块不能读取registry.conf的配置的问题
 - [[#6232](https://github.com/apache/incubator-seata/pull/6232)] 
修复在mysql的json类型下出现Cannot create a JSON value from a string with CHARACTER SET 
'binary'问题
 
diff --git 
a/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java 
b/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java
index 292859058d..7555a62e02 100644
--- a/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java
+++ b/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java
@@ -352,6 +352,9 @@ public class DataSourceProxy extends 
AbstractDataSourceProxy implements Resource
         } else {
             resourceId = jdbcUrl;
         }
+        if (resourceId.contains(",")) {
+            resourceId = resourceId.replace(",", "|");
+        }
     }
 
     /**
diff --git 
a/rm-datasource/src/test/java/io/seata/rm/datasource/DataSourceProxyTest.java 
b/rm-datasource/src/test/java/io/seata/rm/datasource/DataSourceProxyTest.java
index aafae33d0d..ce791027fa 100644
--- 
a/rm-datasource/src/test/java/io/seata/rm/datasource/DataSourceProxyTest.java
+++ 
b/rm-datasource/src/test/java/io/seata/rm/datasource/DataSourceProxyTest.java
@@ -133,6 +133,7 @@ public class DataSourceProxyTest {
             Assertions.assertEquals("jdbc:mock:xxx/username", 
proxy.getResourceId(), "dbType=" + dbTypeField.get(proxy));
         }
 
+
         // case: dbType = postgresql
         {
             resourceIdField.set(proxy, null);
@@ -142,6 +143,23 @@ public class DataSourceProxyTest {
             resourceIdField.set(proxy, null);
             jdbcUrlField.set(proxy, 
"jdbc:postgresql://mock/postgresql?xxx=1111&currentSchema=schema1,schema2&yyy=1");
             
Assertions.assertEquals("jdbc:postgresql://mock/postgresql?currentSchema=schema1!schema2",
 proxy.getResourceId(), "dbType=" + dbTypeField.get(proxy));
+
+            resourceIdField.set(proxy, null);
+            jdbcUrlField.set(proxy, 
"jdbc:postgresql://192.168.1.123:30100,192.168.1.124:30100?xxx=1111&currentSchema=schema1,schema2&yyy=1");
+            
Assertions.assertEquals("jdbc:postgresql://192.168.1.123:30100|192.168.1.124:30100?currentSchema=schema1!schema2",
 proxy.getResourceId(), "dbType=" + dbTypeField.get(proxy));
+
+            jdbcUrlField.set(proxy, jdbcUrl);
+        }
+
+        // case: dbType = dm
+        {
+            resourceIdField.set(proxy, null);
+            dbTypeField.set(proxy, io.seata.sqlparser.util.JdbcConstants.DM);
+            Assertions.assertEquals(jdbcUrl, proxy.getResourceId(), "dbType=" 
+ dbTypeField.get(proxy));
+
+            resourceIdField.set(proxy, null);
+            jdbcUrlField.set(proxy, 
"jdbc:dm://mock/dm?xxx=1111&schema=schema1");
+            Assertions.assertEquals("jdbc:dm://mock/dm?schema=schema1", 
proxy.getResourceId(), "dbType=" + dbTypeField.get(proxy));
             jdbcUrlField.set(proxy, jdbcUrl);
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to