Skip to content

Commit

Permalink
bugfix: AT mode support the URL of a PGSQL cluster (#6261)
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes authored Jan 16, 2024
1 parent 82b036f commit a59a39a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'问题

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ private void initPGResourceId() {
} else {
resourceId = jdbcUrl;
}
if (resourceId.contains(",")) {
resourceId = resourceId.replace(",", "|");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void getResourceIdTest() throws SQLException, NoSuchFieldException, Illeg
Assertions.assertEquals("jdbc:mock:xxx/username", proxy.getResourceId(), "dbType=" + dbTypeField.get(proxy));
}


// case: dbType = postgresql
{
resourceIdField.set(proxy, null);
Expand All @@ -142,6 +143,23 @@ public void getResourceIdTest() throws SQLException, NoSuchFieldException, Illeg
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);
}

Expand Down

0 comments on commit a59a39a

Please sign in to comment.