This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 79352e84c39 Bump the minimum Seata Client version for Seata AT
integration to 2.2.0 (#33872)
79352e84c39 is described below
commit 79352e84c3960a8cd48e040abdd4c0a305230e67
Author: Ling Hengqian <[email protected]>
AuthorDate: Tue Dec 3 09:32:17 2024 +0800
Bump the minimum Seata Client version for Seata AT integration to 2.2.0
(#33872)
---
RELEASE-NOTES.md | 1 +
.../optional-plugins/clickhouse/_index.cn.md | 6 +-
.../optional-plugins/clickhouse/_index.en.md | 6 +-
.../optional-plugins/testcontainers/_index.cn.md | 16 +-
.../optional-plugins/testcontainers/_index.en.md | 14 +-
.../special-api/transaction/seata.cn.md | 260 ++++++++++++++---
.../special-api/transaction/seata.en.md | 316 ++++++++++++++++-----
.../druid/{1.2.7 => 1.2.20}/reflect-config.json | 0
.../druid/{1.2.7 => 1.2.20}/resource-config.json | 0
.../seata-all/{2.1.0 => 2.2.0}/proxy-config.json | 0
.../seata-all/{2.1.0 => 2.2.0}/reflect-config.json | 46 +--
.../{2.1.0 => 2.2.0}/resource-config.json | 11 +-
.../reflect-config.json | 9 +-
.../resource-config.json | 4 +-
.../base/seata/at/fixture/MockSeataServer.java | 8 +-
.../base/seata-at/src/test/resources/file.conf | 37 ---
.../seata-at/src/test/resources/logback-test.xml | 1 -
.../base/seata-at/src/test/resources/registry.conf | 25 --
pom.xml | 2 +-
.../test/natived/commons/TestShardingService.java | 2 -
.../natived/jdbc/databases/ClickHouseTest.java | 4 +-
.../natived/jdbc/transactions/base/SeataTest.java | 4 +-
.../ShardingTest.java => databases/MySQLTest.java} | 6 +-
.../test/natived/proxy/databases/PostgresTest.java | 24 +-
.../reflect-config.json | 4 +-
test/native/src/test/resources/logback-test.xml | 1 -
.../resources/seata-script-client-conf-file.conf | 6 +
.../yaml/jdbc/databases/postgresql.yaml | 6 +-
.../yaml/jdbc/transactions/base/seata.yaml | 6 +-
.../sharding => databases/mysql}/global.yaml | 5 -
.../yaml/proxy/databases/postgresql/global.yaml | 1 -
31 files changed, 559 insertions(+), 272 deletions(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 29ed83b4475..241568b5165 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -31,6 +31,7 @@
1. Proxy Native: Support local transactions of ClickHouse under GraalVM Native
Image - [#33801](https://github.com/apache/shardingsphere/pull/33801)
1. Doc: Adds documentation for ClickHouse support -
[#33779](https://github.com/apache/shardingsphere/pull/33779)
1. Doc: Removes use of `iceberg.mr.schema.auto.conversion` from documentation
due to HIVE-26507 -
[#33828](https://github.com/apache/shardingsphere/pull/33828)
+1. Kernel: Bump the minimum Seata Client version for Seata AT integration to
2.2.0 - [#33872](https://github.com/apache/shardingsphere/pull/33872)
### Bug Fixes
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.cn.md
index ecf0eaeca0b..4c92ac01f19 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.cn.md
@@ -43,7 +43,7 @@ ShardingSphere 对 ClickHouse JDBC Driver 的支持位于可选模块中。
```yaml
services:
clickhouse-server:
- image: clickhouse/clickhouse-server:24.10.2.80
+ image: clickhouse/clickhouse-server:24.11.1.2557
ports:
- "8123:8123"
```
@@ -221,11 +221,11 @@ ClickHouse 支持 ShardingSphere 集成级别的本地事务,但需要对 Clic
```yaml
services:
clickhouse-keeper-01:
- image: clickhouse/clickhouse-keeper:24.10.2.80
+ image: clickhouse/clickhouse-keeper:24.11.1.2557
volumes:
- ./keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml
clickhouse-server:
- image: clickhouse/clickhouse-server:24.10.2.80
+ image: clickhouse/clickhouse-server:24.11.1.2557
depends_on:
- clickhouse-keeper-01
ports:
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.en.md
index 9cfd11bacf3..9b46f250e9b 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.en.md
@@ -43,7 +43,7 @@ Write a Docker Compose file to start ClickHouse.
```yaml
services:
clickhouse-server:
- image: clickhouse/clickhouse-server:24.10.2.80
+ image: clickhouse/clickhouse-server:24.11.1.2557
ports:
- "8123:8123"
```
@@ -227,11 +227,11 @@ Introduce the discussion of writing a Docker Compose file
to start ClickHouse an
```yaml
services:
clickhouse-keeper-01:
- image: clickhouse/clickhouse-keeper:24.10.2.80
+ image: clickhouse/clickhouse-keeper:24.11.1.2557
volumes:
- ./keeper_config.xml:/etc/clickhouse-keeper/keeper_config.xml
clickhouse-server:
- image: clickhouse/clickhouse-server:24.10.2.80
+ image: clickhouse/clickhouse-server:24.11.1.2557
depends_on:
- clickhouse-keeper-01
ports:
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.cn.md
index 64a17855097..c1e8f425068 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.cn.md
@@ -9,7 +9,7 @@ ShardingSphere 默认情况下不提供对 `org.testcontainers.jdbc.ContainerDat
## 前提条件
-要在 ShardingSphere 的配置文件为数据节点使用类似
`jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0` 的 `jdbcUrl`,
+要在 ShardingSphere 的配置文件为数据节点使用类似
`jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0` 的 `jdbcUrl`,
可能的 Maven 依赖关系如下,
```xml
@@ -49,15 +49,15 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_1
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_1
ds_2:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_2
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_2
```
`org.apache.shardingsphere:shardingsphere-infra-database-testcontainers` 为
testcontainers-java 风格的 jdbcURL 提供支持,
@@ -82,13 +82,13 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0
```
-testcontainers 默认情况下仅在对 `jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0`
的最后一个 `java.sql.Connection` 关闭后,
-停止`jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0`创建的 Docker Container。
+testcontainers 默认情况下仅在对 `jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0`
的最后一个 `java.sql.Connection` 关闭后,
+停止`jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0`创建的 Docker Container。
但 ShardingSphere 的内部类会缓存 `java.sql.Connection`。这导致直到 JVM 关闭,
-`jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0` 创建的 Docker Container 才会被关闭。
+`jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0` 创建的 Docker Container 才会被关闭。
若有避免 Container 被长期开启的必要,
`org.testcontainers.jdbc.ContainerDatabaseDriver` 存在可用方法来在单元测试中快速关闭相关
Container,
示例如下,
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.en.md
index 72998c4a57a..82cebf382ec 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/testcontainers/_index.en.md
@@ -9,7 +9,7 @@ ShardingSphere does not provide support for `driverClassName`
of `org.testcontai
## Prerequisites
-To use `jdbcUrl` like `jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0` for
data nodes in ShardingSphere's configuration file,
+To use `jdbcUrl` like `jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0` for
data nodes in ShardingSphere's configuration file,
the possible Maven dependencies are as follows,
```xml
@@ -52,15 +52,15 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_1
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_1
ds_2:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_2
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_2
```
1. Maven module `org.testcontainers:clickhouse:1.20.3` that provides support
for jdbcURL prefixes for `jdbc:tc:clickhouse:`
@@ -82,13 +82,13 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0
+ jdbcUrl: jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0
```
testcontainers, by default,
-stops the Docker Container created by
`jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0` only after the last
`java.sql.Connection` of `jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0` is
closed.
+stops the Docker Container created by
`jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0` only after the last
`java.sql.Connection` of `jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0` is
closed.
But ShardingSphere's internal class will cache `java.sql.Connection`.
-As a result, the Docker Container created by
`jdbc:tc:postgresql:17.1-bookworm://test/demo_ds_0` will not be closed until
the JVM is closed.
+As a result, the Docker Container created by
`jdbc:tc:postgresql:17.2-bookworm://test/demo_ds_0` will not be closed until
the JVM is closed.
If it is necessary to prevent the Container from being opened for a long time,
`org.testcontainers.jdbc.ContainerDatabaseDriver` has a method available to
quickly close the relevant Container in the unit test.
The example is as follows,
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
index 4dfe1068fee..ecb8c6d209a 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
@@ -9,7 +9,7 @@ Apache ShardingSphere 提供 BASE 事务,集成了 Seata 的实现。本文所
## 前提条件
-ShardingSphere 的 Seata 集成仅在 `apache/incubator-seata:v2.1.0` 或更高版本可用。
+ShardingSphere 的 Seata 集成仅在 `apache/incubator-seata:v2.2.0` 或更高版本可用。
对于 `org.apache.seata:seata-all` Maven 模块对应的 Seata Client,此限制同时作用于 HotSpot VM 和
GraalVM Native Image。
引入 Maven 依赖,并排除 `org.apache.seata:seata-all` 中过时的
`org.antlr:antlr4-runtime:4.8` 的 Maven 依赖。
@@ -29,7 +29,7 @@ ShardingSphere 的 Seata 集成仅在 `apache/incubator-seata:v2.1.0`
或更高
<dependency>
<groupId>org.apache.seata</groupId>
<artifactId>seata-all</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0</version>
<exclusions>
<exclusion>
<groupId>org.antlr</groupId>
@@ -42,47 +42,17 @@ ShardingSphere 的 Seata 集成仅在 `apache/incubator-seata:v2.1.0`
或更高
```
受 Calcite 的影响,ShardingSphere JDBC 使用的 `commons-lang:commons-lang` 和
`org.apache.commons:commons-pool2` 与 Seata Client 存在依赖冲突,
-需用户根据实际情景考虑是否需要解决依赖冲突。
+需用户根据实际情景考虑是否需要解决依赖冲突。如果不解决依赖冲突,Maven 等构建工具会在 classpath 随机使用一个冲突依赖的版本。
使用 ShardingSphere 的 Seata 集成模块时,ShardingSphere 连接的数据库实例应同时实现 ShardingSphere
的方言解析支持与 Seata AT 模式的方言解析支持。
这类数据库包括但不限于
`mysql`,`gvenzl/oracle-free`,`gvenzl/oracle-xe`,`postgres`,`mcr.microsoft.com/mssql/server`
等 Docker Image。
-## 操作步骤
-
-1. 启动 Seata Server
-2. 创建日志表
-3. 添加 Seata 配置
-
-## 配置示例
-
-### 启动 Seata Server
-
-按照如下任一链接的步骤,下载并启动 Seata 服务器。
-合理的启动方式应通过 Docker Hub 中的 `apache/seata-server` 的 Docker Image 来实例化 Seata 服务器。
+### `undo_log` 表限制
-- https://hub.docker.com/r/apache/seata-server
+在每一个 ShardingSphere 涉及的真实数据库实例中均需要创建 `undo_log` 表。
+每种数据库的 SQL 的内容以
https://github.com/apache/incubator-seata/tree/v2.2.0/script/client/at/db
内对应的数据库为准。
-### 创建 undo_log 表
-
-在每一个 ShardingSphere 涉及的真实数据库实例中创建 `undo_log` 表。
-SQL 的内容以
https://github.com/apache/incubator-seata/tree/v2.1.0/script/client/at/db
内对应的数据库为准。
-以下内容以 MySQL 为例。
-```sql
-CREATE TABLE IF NOT EXISTS `undo_log`
-(
- `branch_id` BIGINT NOT NULL COMMENT 'branch transaction id',
- `xid` VARCHAR(128) NOT NULL COMMENT 'global transaction id',
- `context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as
serialization',
- `rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info',
- `log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense
status',
- `log_created` DATETIME(6) NOT NULL COMMENT 'create datetime',
- `log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime',
- UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
- ) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT ='AT
transaction mode undo table';
-ALTER TABLE `undo_log` ADD INDEX `ix_log_created` (`log_created`);
-```
-
-### 修改配置
+### 相关配置
在自有项目的 ShardingSphere 的 YAML 配置文件写入如下内容,参考
[分布式事务](/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/transaction)。
若初始化 ShardingSphere JDBC DataSource 时使用的是 Java API,参考
[分布式事务](/cn/user-manual/shardingsphere-jdbc/java-api/rules/transaction)。
@@ -93,8 +63,8 @@ transaction:
providerType: Seata
```
-在 classpath 的根目录中增加 `seata.conf` 文件,
-配置文件格式参考 `org.apache.seata.config.FileConfiguration` 的
[JavaDoc](https://github.com/apache/incubator-seata/blob/v2.1.0/config/seata-config-core/src/main/java/org/apache/seata/config/FileConfiguration.java)。
+在 classpath 的根目录中增加 `seata.conf` 文件,
+配置文件格式参考 `org.apache.seata.config.FileConfiguration` 的
[JavaDoc](https://github.com/apache/incubator-seata/blob/v2.2.0/config/seata-config-core/src/main/java/org/apache/seata/config/FileConfiguration.java)。
`seata.conf` 存在四个属性,
@@ -102,7 +72,7 @@ transaction:
2. `shardingsphere.transaction.seata.tx.timeout`,全局事务超时(秒)。存在默认值为 `60`
3. `client.application.id`,应用唯一主键,用于设置 Seata Transaction Manager Client 和
Seata Resource Manager Client 的 `applicationId`
4. `client.transaction.service.group`,所属事务组, 用于设置 Seata Transaction Manager
Client 和 Seata Resource Manager Client 的 `transactionServiceGroup`。
-存在默认值为 `default`
+ 存在默认值为 `default`
一个完全配置的 `seata.conf` 如下,
@@ -117,7 +87,7 @@ client {
```
一个最小配置的 `seata.conf` 如下。
-由 ShardingSphere 管理的 `seata.conf` 中, `client.transaction.service.group`
的默认值设置为 `default` 是出于历史原因。
+由 ShardingSphere 管理的 `seata.conf` 中, `client.transaction.service.group` 的默认值为
`default` 是出于历史原因。
假设用户使用的 Seata Server 和 Seata Client 的 `registry.conf` 中,`registry.type` 和
`config.type` 均为 `file`,
则对于 `registry.conf` 的 `config.file.name` 配置的 `.conf` 文件中,事务分组名在
`apache/incubator-seata:v1.5.1` 及之后默认值为 `default_tx_group`,
在 `apache/incubator-seata:v1.5.1` 之前则为 `my_test_tx_group`。
@@ -128,6 +98,200 @@ client.application.id = example
根据实际场景修改 Seata 的 `registry.conf` 文件。
+## 操作步骤
+
+1. 启动 Seata Server
+2. 创建 `undo_log` 表
+3. 添加 Seata 配置
+
+## 配置示例
+
+### 启动 Seata Server 和 MySQL Server
+
+编写 Docker Compose 文件来启动 Seata Server 和 MySQL Server。
+
+```yaml
+services:
+ apache-seata-server:
+ image: apache/seata-server:2.2.0
+ ports:
+ - "8091:8091"
+ mysql:
+ image: mysql:9.1.0
+ environment:
+ MYSQL_ROOT_PASSWORD: example
+ volumes:
+ - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
+ ports:
+ - "3306:3306"
+```
+
+`./docker-entrypoint-initdb.d` 文件夹包含文件为 `init.sh`,内容如下,
+
+```shell
+#!/bin/bash
+set -e
+
+mysql -uroot -p"$MYSQL_ROOT_PASSWORD" <<EOSQL
+CREATE DATABASE demo_ds_0;
+CREATE DATABASE demo_ds_1;
+CREATE DATABASE demo_ds_2;
+EOSQL
+
+for i in "demo_ds_0" "demo_ds_1" "demo_ds_2"
+do
+mysql -uroot -p"$MYSQL_ROOT_PASSWORD" "$i" <<'EOSQL'
+CREATE TABLE IF NOT EXISTS `undo_log`
+(
+ `branch_id` BIGINT NOT NULL COMMENT 'branch transaction id',
+ `xid` VARCHAR(128) NOT NULL COMMENT 'global transaction id',
+ `context` VARCHAR(128) NOT NULL COMMENT 'undo_log context,such as
serialization',
+ `rollback_info` LONGBLOB NOT NULL COMMENT 'rollback info',
+ `log_status` INT(11) NOT NULL COMMENT '0:normal status,1:defense
status',
+ `log_created` DATETIME(6) NOT NULL COMMENT 'create datetime',
+ `log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime',
+ UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
+) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT ='AT
transaction mode undo table';
+ALTER TABLE `undo_log` ADD INDEX `ix_log_created` (`log_created`);
+
+CREATE TABLE IF NOT EXISTS t_order (
+ order_id BIGINT NOT NULL AUTO_INCREMENT,
+ order_type INT(11),
+ user_id INT NOT NULL,
+ address_id BIGINT NOT NULL,
+ status VARCHAR(50),
+ PRIMARY KEY (order_id)
+);
+EOSQL
+done
+```
+
+### 在业务项目的 classpath 创建 `seata.conf`
+
+在业务项目的 classpath 创建 `seata.conf`,内容如下,
+
+```
+service {
+ default.grouplist = "127.0.0.1:8091"
+ vgroupMapping.default_tx_group = "default"
+}
+```
+
+### 在业务项目的 classpath 创建 `file.conf`
+
+在业务项目的 classpath 创建 `file.conf`,内容如下,
+
+```
+client {
+ application.id = test
+ transaction.service.group = default_tx_group
+}
+```
+
+### 在业务项目的 classpath 创建 `registry.conf`
+
+在业务项目的 classpath 创建 `registry.conf`,内容如下,
+
+```
+registry {
+ type = "file"
+ file {
+ name = "file.conf"
+ }
+}
+config {
+ type = "file"
+ file {
+ name = "file.conf"
+ }
+}
+```
+
+### 在业务项目创建 ShardingSphere 配置文件
+
+在业务项目引入前提条件涉及的依赖后,在业务项目的 classpath 上编写 ShardingSphere 数据源的配置文件`demo.yaml`,
+
+```yaml
+dataSources:
+ ds_0:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?sslMode=REQUIRED
+ username: root
+ password: example
+ ds_1:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?sslMode=REQUIRED
+ username: root
+ password: example
+ ds_2:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_2?sslMode=REQUIRED
+ username: root
+ password: example
+rules:
+ - !SHARDING
+ tables:
+ t_order:
+ actualDataNodes: ds_$->{0..2}.t_order
+ keyGenerateStrategy:
+ column: order_id
+ keyGeneratorName: snowflake
+ defaultDatabaseStrategy:
+ standard:
+ shardingColumn: user_id
+ shardingAlgorithmName: inline
+ shardingAlgorithms:
+ inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_${user_id % 2}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+transaction:
+ defaultType: BASE
+ providerType: Seata
+```
+
+### 享受集成
+
+在 ShardingSphere 的数据源上可开始享受集成,
+
+```java
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+@SuppressWarnings({"SqlNoDataSourceInspection", "AssertWithSideEffects"})
+public class ExampleTest {
+ void test() throws SQLException {
+ HikariConfig config = new HikariConfig();
+ config.setJdbcUrl("jdbc:shardingsphere:classpath:demo.yaml");
+
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
+ try (HikariDataSource dataSource = new HikariDataSource(config)) {
+ try (Connection conn = dataSource.getConnection()) {
+ try {
+ conn.setAutoCommit(false);
+ conn.createStatement().executeUpdate("INSERT INTO t_order
(user_id, order_type, address_id, status) VALUES (2024, 1, 2024,
'INSERT_TEST')");
+ conn.createStatement().executeUpdate("INSERT INTO
t_order_does_not_exist (test_id_does_not_exist) VALUES (2024)");
+ conn.commit();
+ } catch (final SQLException ignored) {
+ conn.rollback();
+ } finally {
+ conn.setAutoCommit(true);
+ }
+ }
+ try (Connection conn = dataSource.getConnection()) {
+ assert !conn.createStatement().executeQuery("SELECT * FROM
t_order_item WHERE user_id = 2024").next();
+ }
+ }
+ }
+}
+```
+
## 使用限制
ShardingSphere 的 Seata 集成不支持隔离级别。
@@ -137,7 +301,7 @@ ShardingSphere 的 Seata 集成将获取到的 Seata 全局事务置入线程的
这意味着用户在使用 ShardingSphere 的 Seata 集成时,用户应避免使用 `org.apache.seata:seata-all` 的
Java API,
除非用户正在混合使用 ShardingSphere 的 Seata 集成与 Seata Client 的 TCC 模式特性。
-针对 ShardingSphere 数据源,讨论 6 种情况,
+针对 ShardingSphere 数据源,讨论 7 种情况,
1. 手动获取从 ShardingSphere 数据源创建的 `java.sql.Connection` 实例,并手动调用
`setAutoCommit()`, `commit()` 和 `rollback()` 方法,
这是被允许的。
@@ -148,9 +312,13 @@ ShardingSphere 的 Seata 集成将获取到的 Seata 全局事务置入线程的
4. 在函数上使用 Spring Framework 的
`org.springframework.transaction.annotation.Transactional` 注解,这是被允许的。
-5. 在函数上使用 `org.apache.seata.spring.annotation.GlobalTransactional`
注解,这是**不被允许的**。
+5. 手动获取从 `org.springframework.transaction.PlatformTransactionManager` 实例创建的
`org.springframework.transaction.support.TransactionTemplate` 实例,
+并使用
`org.springframework.transaction.support.TransactionTemplate#execute(org.springframework.transaction.support.TransactionCallback)`,
+这是被允许的。
+
+6. 在函数上使用 `org.apache.seata.spring.annotation.GlobalTransactional`
注解,这是**不被允许的**。
-6. 手动从 `org.apache.seata.tm.api.GlobalTransactionContext ` 创建
`org.apache.seata.tm.api.GlobalTransaction` 实例,
+7. 手动从 `org.apache.seata.tm.api.GlobalTransactionContext ` 创建
`org.apache.seata.tm.api.GlobalTransaction` 实例,
调用 `org.apache.seata.tm.api.GlobalTransaction` 实例的 `begin()`, `commit()` 和
`rollback()` 方法,这是**不被允许的**。
在使用 Spring Boot 的实际情景中,
@@ -173,7 +341,7 @@ ShardingSphere 的 Seata 集成将获取到的 Seata 全局事务置入线程的
<dependency>
<groupId>org.apache.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0</version>
<exclusions>
<exclusion>
<groupId>org.antlr</groupId>
@@ -378,7 +546,7 @@ public class CustomWebMvcConfigurer implements
WebMvcConfigurer {
3. 微服务实例 `a-service` 和 `b-service` 均为 Spring Boot 微服务,但使用的 API 网关中间件阻断了所有包含
`TX_XID` 的 HTTP Header 的 HTTP 请求。
用户需要考虑更改把 XID 通过服务调用传递到微服务实例 `a-service` 使用的 HTTP Header,或使用 RPC 框架把 XID
通过服务调用传递到微服务实例 `a-service`。
-参考 https://github.com/apache/incubator-seata/tree/v2.1.0/integration 。
+参考 https://github.com/apache/incubator-seata/tree/v2.2.0/integration 。
4. 微服务实例 `a-service` 和 `b-service` 均为 Quarkus,Micronaut Framework 和 Helidon
等微服务。
此情况下无法使用 Spring WebMVC HandlerInterceptor。
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
index 79fbf300d9f..fd1ba10956d 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
@@ -10,7 +10,7 @@ All references to Seata integration in this article refer to
Seata AT mode.
## Prerequisites
-ShardingSphere's Seata integration is only available in
`apache/incubator-seata:v2.1.0` or higher.
+ShardingSphere's Seata integration is only available in
`apache/incubator-seata:v2.2.0` or higher.
For Seata Client corresponding to the `org.apache.seata:seata-all` Maven
module, this limitation applies to both HotSpot VM and GraalVM Native Image.
Introduce Maven dependencies and exclude the outdated Maven dependency of
`org.antlr:antlr4-runtime:4.8` in `org.apache.seata:seata-all`.
@@ -28,50 +28,132 @@ Introduce Maven dependencies and exclude the outdated
Maven dependency of `org.a
<version>${shardingsphere.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.seata</groupId>
- <artifactId>seata-all</artifactId>
- <version>2.1.0</version>
- <exclusions>
+ <groupId>org.apache.seata</groupId>
+ <artifactId>seata-all</artifactId>
+ <version>2.2.0</version>
+ <exclusions>
<exclusion>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</exclusion>
- </exclusions>
+ </exclusions>
</dependency>
</dependencies>
</project>
```
-Affected by Calcite,
-`commons-lang:commons-lang` and `org.apache.commons:commons-pool2` used by
ShardingSphere JDBC have dependency conflicts with Seata Client.
-Users need to consider whether to resolve dependency conflicts based on actual
scenarios.
+Affected by Calcite, `commons-lang:commons-lang` and
`org.apache.commons:commons-pool2` used by ShardingSphere JDBC have dependency
conflicts with Seata Client.
+Users need to consider whether to resolve dependency conflicts based on actual
scenarios.
+If dependency conflicts are not resolved,
+build tools such as Maven will randomly use a version of the conflicting
dependency in the classpath.
When using ShardingSphere's Seata integration module,
-the database instance connected to ShardingSphere should implement both
ShardingSphere's dialect parsing support and Seata AT mode's dialect parsing
support.
-Such databases include but are not limited to `mysql`, `gvenzl/oracle-free`,
`gvenzl/oracle-xe`, `postgres`, `mcr.microsoft.com/mssql/server` and other
Docker Images.
+the database instance connected to ShardingSphere should implement both
ShardingSphere's dialect parsing support and Seata AT mode's dialect parsing
support.
+This type of database includes but is not limited to `mysql`,
`gvenzl/oracle-free`, `gvenzl/oracle-xe`, `postgres`,
+`mcr.microsoft.com/mssql/server` and other Docker Images.
-## Procedure
+### `undo_log` table restrictions
+
+In each real database instance involved in ShardingSphere, an `undo_log` table
needs to be created.
+The SQL content of each database is based on the corresponding database in
https://github.com/apache/incubator-seata/tree/v2.2.0/script/client/at/db .
+
+### Related configuration
+
+Write the following content in the YAML configuration file of ShardingSphere
of your own project,
+refer to [Distributed
Transaction](/en/user-manual/shardingsphere-jdbc/yaml-config/rules/transaction).
+If Java API is used when initializing ShardingSphere JDBC DataSource,
+refer to [Distributed
Transaction](/en/user-manual/shardingsphere-jdbc/java-api/rules/transaction).
+
+```yaml
+transaction:
+ defaultType: BASE
+ providerType: Seata
+```
+
+Add the `seata.conf` file to the root directory of the classpath.
+For the configuration file format, refer to the
[JavaDoc](https://github.com/apache/incubator-seata/blob/v2.2.0/config/seata-config-core/src/main/java/org/apache/seata/config/FileConfiguration.java)
of `org.apache.seata.config.FileConfiguration`.
+
+`seata.conf` has four properties,
+
+1. `shardingsphere.transaction.seata.at.enable`, when this value is `true`,
enable ShardingSphere's Seata AT integration.
+The default value is `true`
+
+2. `shardingsphere.transaction.seata.tx.timeout`, global transaction timeout
(seconds). The default value is `60`
+
+3. `client.application.id`, application unique primary key,
+used to set `applicationId` of Seata Transaction Manager Client and Seata
Resource Manager Client
+
+4. `client.transaction.service.group`, transaction group,
+used to set `transactionServiceGroup` of Seata Transaction Manager Client and
Seata Resource Manager Client. The default value is `default`
+
+A fully configured `seata.conf` is as follows,
+
+```conf
+shardingsphere.transaction.seata.at.enable = true
+shardingsphere.transaction.seata.tx.timeout = 60
+
+client {
+ application.id = example
+ transaction.service.group = default_tx_group
+}
+```
+
+A minimally configured `seata.conf` is as follows.
+In `seata.conf` managed by ShardingSphere, the default value of
`client.transaction.service.group` is `default` for historical reasons.
+Assuming that `registry.type` and `config.type` are both `file` in
`registry.conf` of Seata Server and Seata Client used by the user,
+then for `registry.file.name` of `registry.conf`,
+the transaction group name in the `.conf` file configured by
`config.file.name` is `default_tx_group` in `apache/incubator-seata:v1.5.1` and
later,
+and `my_test_tx_group` before `apache/incubator-seata:v1.5.1`.
+
+```conf
+client.application.id = example
+```
+
+Modify Seata's `registry.conf` file according to the actual scenario.
+
+## Operation steps
1. Start Seata Server
-2. Create the log table
-3. Add the Seata configuration
+2. Create `undo_log` table
+3. Add Seata configuration
+
+## Configuration Example
-## Sample
+### Start Seata Server and MySQL Server
-### Start Seata Server
+Write Docker Compose file to start Seata Server and MySQL Server.
-Follow the steps in one of the links below to download and start Seata Server.
+```yaml
+services:
+ apache-seata-server:
+ image: apache/seata-server:2.2.0
+ ports:
+ - "8091:8091"
+ mysql:
+ image: mysql:9.1.0
+ environment:
+ MYSQL_ROOT_PASSWORD: example
+ volumes:
+ - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
+ ports:
+ - "3306:3306"
+```
-The proper way to start Seata Server is to instantiate it through the Docker
Image of `apache/seata-server` in Docker Hub.
+The `./docker-entrypoint-initdb.d` folder contains the file `init.sh`, the
content is as follows,
-- https://hub.docker.com/r/apache/seata-server
+```shell
+#!/bin/bash
+set -e
-### Create undo_log table
+mysql -uroot -p"$MYSQL_ROOT_PASSWORD" <<EOSQL
+CREATE DATABASE demo_ds_0;
+CREATE DATABASE demo_ds_1;
+CREATE DATABASE demo_ds_2;
+EOSQL
-Create the `undo_log` table in each real database instance involved in
ShardingSphere.
-The SQL content is based on the corresponding database in
https://github.com/apache/incubator-seata/tree/v2.1.0/script/client/at/db .
-The following content takes MySQL as an example.
-```sql
+for i in "demo_ds_0" "demo_ds_1" "demo_ds_2"
+do
+mysql -uroot -p"$MYSQL_ROOT_PASSWORD" "$i" <<'EOSQL'
CREATE TABLE IF NOT EXISTS `undo_log`
(
`branch_id` BIGINT NOT NULL COMMENT 'branch transaction id',
@@ -82,59 +164,147 @@ CREATE TABLE IF NOT EXISTS `undo_log`
`log_created` DATETIME(6) NOT NULL COMMENT 'create datetime',
`log_modified` DATETIME(6) NOT NULL COMMENT 'modify datetime',
UNIQUE KEY `ux_undo_log` (`xid`, `branch_id`)
- ) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT
='AT transaction mode undo table';
+) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT ='AT
transaction mode undo table';
ALTER TABLE `undo_log` ADD INDEX `ix_log_created` (`log_created`);
-```
-### Modify configuration
+CREATE TABLE IF NOT EXISTS t_order (
+ order_id BIGINT NOT NULL AUTO_INCREMENT,
+ order_type INT(11),
+ user_id INT NOT NULL,
+ address_id BIGINT NOT NULL,
+ status VARCHAR(50),
+ PRIMARY KEY (order_id)
+);
+EOSQL
+done
+```
-Write the following content in the YAML configuration file of ShardingSphere
of your own project,
-refer to [Distributed
Transaction](/en/user-manual/shardingsphere-jdbc/yaml-config/rules/transaction).
+### Create `seata.conf` in the classpath of the business project
-If Java API is used when initializing ShardingSphere JDBC DataSource,
-refer to [Distributed
Transaction](/en/user-manual/shardingsphere-jdbc/java-api/rules/transaction).
+Create `seata.conf` in the classpath of the business project, with the
following content,
-```yaml
-transaction:
- defaultType: BASE
- providerType: Seata
+```
+service {
+ default.grouplist = "127.0.0.1:8091"
+ vgroupMapping.default_tx_group = "default"
+}
```
-Add the `seata.conf` file to the root directory of the classpath.
-The configuration file format refers to the
[JavaDoc](https://github.com/apache/incubator-seata/blob/v2.1.0/config/seata-config-core/src/main/java/org/apache/seata/config/FileConfiguration.java)
of `org.apache.seata.config.FileConfiguration`.
+### Create `file.conf` in the classpath of the business project
-There are four properties in `seata.conf`,
+Create `file.conf` in the classpath of the business project, with the
following content,
-1. `shardingsphere.transaction.seata.at.enable`, when this value is `true`,
enable ShardingSphere's Seata AT integration. The default value is `true`
-2. `shardingsphere.transaction.seata.tx.timeout`, global transaction timeout
(seconds). The default value is `60`
-3. `client.application.id`, application unique primary key, used to set
`applicationId` of Seata Transaction Manager Client and Seata Resource Manager
Client
-4. `client.transaction.service.group`, transaction group, used to set
`transactionServiceGroup` of Seata Transaction Manager Client and Seata
Resource Manager Client.
-The default value is `default`
+```
+client {
+ application.id = test
+ transaction.service.group = default_tx_group
+}
+```
-A fully configured `seata.conf` is as follows,
+### Create `registry.conf` in the classpath of the business project
-```conf
-shardingsphere.transaction.seata.at.enable = true
-shardingsphere.transaction.seata.tx.timeout = 60
+Create a `registry.conf` in the classpath of the business project with the
following content:
-client {
- application.id = example
- transaction.service.group = default_tx_group
+```
+registry {
+ type = "file"
+ file {
+ name = "file.conf"
+ }
+}
+config {
+ type = "file"
+ file {
+ name = "file.conf"
+ }
}
```
-A minimally configured `seata.conf` is as follows.
-In `seata.conf` managed by ShardingSphere, the default value of
`client.transaction.service.group` is set to `default` for historical reasons.
-Assuming that in the `registry.conf` of Seata Server and Seata Client used by
the user, `registry.type` and `config.type` are both `file`,
-then for the `.conf` file configured by `config.file.name` of `registry.conf`,
-the default transaction group name is `default_tx_group` in
`apache/incubator-seata:v1.5.1` and later,
-and `my_test_tx_group` before `apache/incubator-seata:v1.5.1`.
+### Create ShardingSphere configuration file in business project
-```conf
-client.application.id = example
+After the business project introduces the dependencies involved in the
prerequisites,
+write the ShardingSphere data source configuration file `demo.yaml` on the
classpath of the business project,
+
+```yaml
+dataSources:
+ ds_0:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?sslMode=REQUIRED
+ username: root
+ password: example
+ ds_1:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?sslMode=REQUIRED
+ username: root
+ password: example
+ ds_2:
+ dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+ driverClassName: com.mysql.cj.jdbc.Driver
+ jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_2?sslMode=REQUIRED
+ username: root
+ password: example
+rules:
+ - !SHARDING
+ tables:
+ t_order:
+ actualDataNodes: ds_$->{0..2}.t_order
+ keyGenerateStrategy:
+ column: order_id
+ keyGeneratorName: snowflake
+ defaultDatabaseStrategy:
+ standard:
+ shardingColumn: user_id
+ shardingAlgorithmName: inline
+ shardingAlgorithms:
+ inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_${user_id % 2}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+transaction:
+ defaultType: BASE
+ providerType: Seata
```
-Modify the `registry.conf` file of Seata as required.
+### Enjoy integration
+
+You can start enjoying integration on ShardingSphere’s data source.
+
+```java
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+@SuppressWarnings({"SqlNoDataSourceInspection", "AssertWithSideEffects"})
+public class ExampleTest {
+ void test() throws SQLException {
+ HikariConfig config = new HikariConfig();
+ config.setJdbcUrl("jdbc:shardingsphere:classpath:demo.yaml");
+
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
+ try (HikariDataSource dataSource = new HikariDataSource(config)) {
+ try (Connection conn = dataSource.getConnection()) {
+ try {
+ conn.setAutoCommit(false);
+ conn.createStatement().executeUpdate("INSERT INTO t_order
(user_id, order_type, address_id, status) VALUES (2024, 1, 2024,
'INSERT_TEST')");
+ conn.createStatement().executeUpdate("INSERT INTO
t_order_does_not_exist (test_id_does_not_exist) VALUES (2024)");
+ conn.commit();
+ } catch (final SQLException ignored) {
+ conn.rollback();
+ } finally {
+ conn.setAutoCommit(true);
+ }
+ }
+ try (Connection conn = dataSource.getConnection()) {
+ assert !conn.createStatement().executeQuery("SELECT * FROM
t_order_item WHERE user_id = 2024").next();
+ }
+ }
+ }
+}
+```
## Usage restrictions
@@ -145,21 +315,27 @@ And
`org.apache.seata.spring.annotation.GlobalTransactionScanner` uses Dynamic P
This means that when using ShardingSphere's Seata integration, users should
avoid using the Java API of `org.apache.seata:seata-all`,
unless the user is mixing ShardingSphere's Seata integration with the TCC mode
feature of Seata Client.
-For ShardingSphere data source, discuss 6 situations,
+For ShardingSphere data source, 7 situations are discussed.
+
+1. Manually obtain the `java.sql.Connection` instance created from the
ShardingSphere data source and manually call the `setAutoCommit()`, `commit()`
and `rollback()` methods.
+This is allowed.
-1. Manually obtain the `java.sql.Connection` instance created from the
ShardingSphere data source,
-and manually calling the `setAutoCommit()`, `commit()` and `rollback()`
methods is allowed.
+2. Use the `javax.transaction.Transactional` annotation of Jakarta EE 8 on the
function. This is allowed.
-2. Using the Jakarta EE 8 `javax.transaction.Transactional` annotation on the
function is allowed.
+3. Use the `jakarta.transaction.Transactional` annotation of Jakarta EE 9/10
on the function. This is allowed.
-3. Using Jakarta EE 9/10’s `jakarta.transaction.Transactional` annotation on
functions is allowed.
+4. Use the `org.springframework.transaction.annotation.Transactional`
annotation of Spring Framework on the function.
+This is allowed.
-4. Using Spring Framework’s
`org.springframework.transaction.annotation.Transactional` annotation on
functions is allowed.
+5. Manually obtain an
`org.springframework.transaction.support.TransactionTemplate` instance created
from an `org.springframework.transaction.PlatformTransactionManager` instance,
+ and use
`org.springframework.transaction.support.TransactionTemplate#execute(org.springframework.transaction.support.TransactionCallback)`,
+ which is allowed.
-5. Using the `org.apache.seata.spring.annotation.GlobalTransactional`
annotation on the function is **not allowed**.
+6. Use the `org.apache.seata.spring.annotation.GlobalTransactional` annotation
on a function, which is **not allowed**.
-6. Manually create `org.apache.seata.tm.api.GlobalTransaction` instance from
`org.apache.seata.tm.api.GlobalTransactionContext`,
-calling the `begin()`, `commit()` and `rollback()` methods of an
`org.apache.seata.tm.api.GlobalTransaction` instance is **not allowed**.
+7. Manually create an `org.apache.seata.tm.api.GlobalTransaction` instance
from an `org.apache.seata.tm.api.GlobalTransactionContext`,
+ and call the `begin()`, `commit()`, and `rollback()` methods of the
`org.apache.seata.tm.api.GlobalTransaction` instance,
+ which is **not allowed**.
In actual scenarios where Spring Boot is used,
`com.alibaba.cloud:spring-cloud-starter-alibaba-seata` and
`org.apache.seata:seata-spring-boot-starter` are often transitively imported by
other Maven dependencies.
@@ -182,7 +358,7 @@ A possible dependency relationship is as follows.
<dependency>
<groupId>org.apache.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0</version>
<exclusions>
<exclusion>
<groupId>org.antlr</groupId>
@@ -402,7 +578,7 @@ the changes to the MySQL database instances `a-mysql` and
`b-mysql` in the busin
but the API gateway middleware used blocks all HTTP requests containing the
HTTP Header of `TX_XID`.
The user needs to consider changing the HTTP Header used to pass XID to the
microservice instance `a-service` through service calls,
or use the RPC framework to pass XID to the microservice instance `a-service`
through service calls.
-Refer to https://github.com/apache/incubator-seata/tree/v2.1.0/integration .
+Refer to https://github.com/apache/incubator-seata/tree/v2.2.0/integration .
4. The microservice instances `a-service` and `b-service` are both
microservices such as Quarkus,
Micronaut Framework and Helidon. In this case, Spring WebMVC
HandlerInterceptor cannot be used.
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.7/reflect-config.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.20/reflect-config.json
similarity index 100%
rename from
infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.7/reflect-config.json
rename to
infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.20/reflect-config.json
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.7/resource-config.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.20/resource-config.json
similarity index 100%
rename from
infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.7/resource-config.json
rename to
infra/reachability-metadata/src/main/resources/META-INF/native-image/com.alibaba/druid/1.2.20/resource-config.json
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/proxy-config.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/proxy-config.json
similarity index 100%
rename from
infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/proxy-config.json
rename to
infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/proxy-config.json
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/reflect-config.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/reflect-config.json
similarity index 95%
rename from
infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/reflect-config.json
rename to
infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/reflect-config.json
index 7a99148da23..32508ed4a02 100644
---
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/reflect-config.json
+++
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/reflect-config.json
@@ -28,7 +28,7 @@
"name":"io.seata.core.rpc.hook.RpcHook"
},
{
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"name":"io.seata.core.serializer.Serializer"
},
{
@@ -94,7 +94,7 @@
"name":"org.apache.seata.config.Configuration"
},
{
-
"condition":{"typeReachable":"org.apache.seata.config.ConfigurationCache$$Lambda/0x00007fea13cd9cb0"},
+
"condition":{"typeReachable":"org.apache.seata.config.ConfigurationCache$$Lambda/0x00007fda3bd03530"},
"name":"org.apache.seata.config.Configuration"
},
{
@@ -156,11 +156,11 @@
},
{
"condition":{"typeReachable":"org.apache.seata.core.rpc.netty.NettyClientBootstrap$1"},
- "name":"org.apache.seata.core.rpc.netty.v1.ProtocolV1Decoder"
+ "name":"org.apache.seata.core.rpc.netty.v1.ProtocolDecoderV1"
},
{
"condition":{"typeReachable":"org.apache.seata.core.rpc.netty.NettyClientBootstrap$1"},
- "name":"org.apache.seata.core.rpc.netty.v1.ProtocolV1Encoder"
+ "name":"org.apache.seata.core.rpc.netty.v1.ProtocolEncoderV1"
},
{
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
@@ -187,6 +187,10 @@
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
"name":"org.apache.seata.discovery.registry.nacos.NacosRegistryProvider"
},
+{
+
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
+
"name":"org.apache.seata.discovery.registry.namingserver.NamingserverRegistryProvider"
+},
{
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
"name":"org.apache.seata.discovery.registry.raft.RaftRegistryProvider"
@@ -281,7 +285,7 @@
"name":"org.apache.seata.rm.datasource.sql.struct.Field"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fea13db8000"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fda3bdf6300"},
"name":"org.apache.seata.rm.datasource.sql.struct.Field"
},
{
@@ -306,7 +310,7 @@
"name":"org.apache.seata.rm.datasource.sql.struct.Field"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fea13d17d98"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fda3bde4000"},
"name":"org.apache.seata.rm.datasource.sql.struct.Field"
},
{
@@ -350,7 +354,7 @@
"name":"org.apache.seata.rm.datasource.sql.struct.Row"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fea13db8000"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fda3bdf6300"},
"name":"org.apache.seata.rm.datasource.sql.struct.Row"
},
{
@@ -375,7 +379,7 @@
"name":"org.apache.seata.rm.datasource.sql.struct.Row"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fea13d17d98"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fda3bde4000"},
"name":"org.apache.seata.rm.datasource.sql.struct.Row"
},
{
@@ -407,7 +411,7 @@
"name":"org.apache.seata.rm.datasource.sql.struct.TableRecords"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fea13db8000"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fda3bdf6300"},
"name":"org.apache.seata.rm.datasource.sql.struct.TableRecords"
},
{
@@ -432,7 +436,7 @@
"name":"org.apache.seata.rm.datasource.sql.struct.TableRecords"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fea13d17d98"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fda3bde4000"},
"name":"org.apache.seata.rm.datasource.sql.struct.TableRecords"
},
{
@@ -508,7 +512,7 @@
"name":"org.apache.seata.rm.datasource.undo.BranchUndoLog"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fea13db8000"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fda3bdf6300"},
"name":"org.apache.seata.rm.datasource.undo.BranchUndoLog"
},
{
@@ -533,7 +537,7 @@
"name":"org.apache.seata.rm.datasource.undo.BranchUndoLog"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fea13d17d98"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fda3bde4000"},
"name":"org.apache.seata.rm.datasource.undo.BranchUndoLog"
},
{
@@ -565,7 +569,7 @@
"name":"org.apache.seata.rm.datasource.undo.SQLUndoLog"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fea13db8000"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.ConnectionProxy$$Lambda/0x00007fda3bdf6300"},
"name":"org.apache.seata.rm.datasource.undo.SQLUndoLog"
},
{
@@ -590,7 +594,7 @@
"name":"org.apache.seata.rm.datasource.undo.SQLUndoLog"
},
{
-
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fea13d17d98"},
+
"condition":{"typeReachable":"org.apache.seata.rm.datasource.exec.AbstractDMLBaseExecutor$$Lambda/0x00007fda3bde4000"},
"name":"org.apache.seata.rm.datasource.undo.SQLUndoLog"
},
{
@@ -718,17 +722,21 @@
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"name":"org.apache.seata.serializer.hessian.HessianSerializer"
},
{
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"name":"org.apache.seata.serializer.kryo.KryoSerializer"
},
{
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+ "condition":{"typeReachable":"org.apache.seata.common.util.ReflectionUtil"},
+ "name":"org.apache.seata.serializer.protobuf.ProtobufSerializer"
+},
+{
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"name":"org.apache.seata.serializer.seata.SeataSerializer",
- "methods":[{"name":"<init>","parameterTypes":[] }]
+ "methods":[{"name":"<init>","parameterTypes":["java.lang.Byte"] }]
},
{
"condition":{"typeReachable":"org.apache.seata.rm.datasource.PreparedStatementProxy"},
@@ -824,7 +832,7 @@
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
-
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader"},
"name":"io.seata.config.file.FileConfig"
}
]
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/resource-config.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/resource-config.json
similarity index 95%
rename from
infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/resource-config.json
rename to
infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/resource-config.json
index 44a5a1bdb11..2eafff6c810 100644
---
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.1.0/resource-config.json
+++
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.seata/seata-all/2.2.0/resource-config.json
@@ -1,9 +1,6 @@
{
"resources":{
"includes":[{
-
"condition":{"typeReachable":"org.apache.seata.sqlparser.druid.DruidDbTypeParserImpl"},
- "pattern":"\\QMETA-INF/druid-driver.properties\\E"
- }, {
"condition":{"typeReachable":"org.apache.seata.config.ConfigurationFactory"},
"pattern":"\\QMETA-INF/seata/io.seata.config.ConfigurationProvider\\E"
}, {
@@ -16,7 +13,7 @@
"condition":{"typeReachable":"org.apache.seata.rm.DefaultResourceManager"},
"pattern":"\\QMETA-INF/seata/io.seata.core.model.ResourceManager\\E"
}, {
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"pattern":"\\QMETA-INF/seata/io.seata.core.serializer.Serializer\\E"
}, {
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
@@ -49,7 +46,7 @@
"condition":{"typeReachable":"org.apache.seata.core.rpc.netty.AbstractNettyRemoting"},
"pattern":"\\QMETA-INF/seata/org.apache.seata.core.rpc.hook.RpcHook\\E"
}, {
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"pattern":"\\QMETA-INF/seata/org.apache.seata.core.serializer.Serializer\\E"
}, {
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
@@ -100,7 +97,7 @@
"condition":{"typeReachable":"org.apache.seata.rm.DefaultResourceManager"},
"pattern":"\\QMETA-INF/services/io.seata.core.model.ResourceManager\\E"
}, {
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"pattern":"\\QMETA-INF/services/io.seata.core.serializer.Serializer\\E"
}, {
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
@@ -133,7 +130,7 @@
"condition":{"typeReachable":"org.apache.seata.core.rpc.netty.AbstractNettyRemoting"},
"pattern":"\\QMETA-INF/services/org.apache.seata.core.rpc.hook.RpcHook\\E"
}, {
-
"condition":{"typeReachable":"org.apache.seata.core.serializer.SerializerServiceLoader"},
+
"condition":{"typeReachable":"org.apache.seata.common.loader.EnhancedServiceLoader$InnerEnhancedServiceLoader"},
"pattern":"\\QMETA-INF/services/org.apache.seata.core.serializer.Serializer\\E"
}, {
"condition":{"typeReachable":"org.apache.seata.discovery.registry.RegistryFactory"},
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
index 3988f03fe69..cfc679a917f 100644
---
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
+++
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json
@@ -16,7 +16,7 @@
"name":"[Lcom.github.dockerjava.api.model.VolumesFrom;"
},
{
-
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.connection.DriverDatabaseConnectionManager$$Lambda/0x00007f1137caca88"},
+
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.connection.DriverDatabaseConnectionManager$$Lambda/0x00007f4323cba690"},
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
},
{
@@ -2080,7 +2080,7 @@
"queryAllDeclaredMethods":true
},
{
-
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.listener.DatabaseMetaDataChangedListener$$Lambda/0x00007f1137b2dc80"},
+
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.listener.DatabaseMetaDataChangedListener$$Lambda/0x00007f4323b37268"},
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.MetaDataChangedSubscriber"
},
{
@@ -3649,5 +3649,10 @@
{
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.initializer.BootstrapInitializer"},
"name":"org.apache.shardingsphere.transaction.yaml.config.YamlTransactionRuleConfigurationCustomizer"
+},
+{
+
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine"},
+ "name":"sun.security.provider.SecureRandom",
+ "methods":[{"name":"<init>","parameterTypes":[] },
{"name":"<init>","parameterTypes":["java.security.SecureRandomParameters"] }]
}
]
\ No newline at end of file
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json
index 4355d10bc0b..7feb8bd88b7 100644
---
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json
+++
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json
@@ -79,7 +79,7 @@
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.connection.DriverDatabaseConnectionManager"},
"pattern":"\\QMETA-INF/services/com.clickhouse.client.ClickHouseClient\\E"
}, {
-
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.connection.DriverDatabaseConnectionManager$$Lambda/0x00007f1137b39f20"},
+
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.connection.DriverDatabaseConnectionManager$$Lambda/0x00007f4323b43d20"},
"pattern":"\\QMETA-INF/services/com.clickhouse.client.ClickHouseClient\\E"
}, {
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource"},
@@ -244,7 +244,7 @@
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandlerFactory"},
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.checker.SQLExecutionChecker\\E"
}, {
-
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor"},
+
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine"},
"pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.sql.hook.SQLExecutionHook\\E"
}, {
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.sql.prepare.AbstractExecutionPrepareEngine"},
diff --git
a/kernel/transaction/type/base/seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/fixture/MockSeataServer.java
b/kernel/transaction/type/base/seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/fixture/MockSeataServer.java
index a7d32ee88fc..b8cc9655f43 100644
---
a/kernel/transaction/type/base/seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/fixture/MockSeataServer.java
+++
b/kernel/transaction/type/base/seata-at/src/test/java/org/apache/shardingsphere/transaction/base/seata/at/fixture/MockSeataServer.java
@@ -26,11 +26,11 @@ import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
-import org.apache.seata.core.rpc.netty.v1.ProtocolV1Decoder;
-import org.apache.seata.core.rpc.netty.v1.ProtocolV1Encoder;
import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
+import org.apache.seata.core.rpc.netty.v1.ProtocolDecoderV1;
+import org.apache.seata.core.rpc.netty.v1.ProtocolEncoderV1;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -77,8 +77,8 @@ public final class MockSeataServer {
@Override
public void initChannel(final SocketChannel socketChannel)
{
socketChannel.pipeline()
- .addLast(new ProtocolV1Decoder())
- .addLast(new ProtocolV1Encoder())
+ .addLast(new ProtocolDecoderV1())
+ .addLast(new ProtocolEncoderV1())
.addLast(messageHandler);
}
});
diff --git a/kernel/transaction/type/base/seata-at/src/test/resources/file.conf
b/kernel/transaction/type/base/seata-at/src/test/resources/file.conf
index 0a3731adf57..783e7d901e2 100644
--- a/kernel/transaction/type/base/seata-at/src/test/resources/file.conf
+++ b/kernel/transaction/type/base/seata-at/src/test/resources/file.conf
@@ -15,44 +15,7 @@
# limitations under the License.
#
-transport {
- # tcp udt unix-domain-socket
- type = "TCP"
- #NIO NATIVE
- server = "NIO"
- #enable heartbeat
- heartbeat = true
- #thread factory for netty
- thread-factory {
- boss-thread-prefix = "NettyBoss"
- worker-thread-prefix = "NettyServerNIOWorker"
- server-executor-thread-prefix = "NettyServerBizHandler"
- share-boss-worker = false
- client-selector-thread-prefix = "NettyClientSelector"
- client-selector-thread-size = 1
- client-worker-thread-prefix = "NettyClientWorkerThread"
- # netty boss thread size,will not be used for UDT
- boss-thread-size = 1
- #auto default pin or 8
- worker-thread-size = 8
- }
-}
service {
- #vgroup->rgroup
vgroupMapping.default_tx_group = "default"
- #only support single node
default.grouplist = "127.0.0.1:8891"
- #disable
- disable = false
-}
-
-client {
- async.commit.buffer.limit = 10000
- lock {
- retry.internal = 10
- retry.times = 30
- }
- tm {
- degradeCheck = false
- }
}
diff --git
a/kernel/transaction/type/base/seata-at/src/test/resources/logback-test.xml
b/kernel/transaction/type/base/seata-at/src/test/resources/logback-test.xml
index d17f7efbfaf..c077d990130 100644
--- a/kernel/transaction/type/base/seata-at/src/test/resources/logback-test.xml
+++ b/kernel/transaction/type/base/seata-at/src/test/resources/logback-test.xml
@@ -26,7 +26,6 @@
<logger name="org.apache.shardingsphere" level="warn" additivity="false">
<appender-ref ref="console" />
</logger>
-
<root>
<level value="error" />
<appender-ref ref="console" />
diff --git
a/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf
b/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf
index 2ed8a6903a0..6801e320a70 100644
--- a/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf
+++ b/kernel/transaction/type/base/seata-at/src/test/resources/registry.conf
@@ -16,38 +16,13 @@
#
registry {
- # file 、eureka、redis、zk
type = "file"
-
- eureka {
- serviceUrl = "http://localhost:1001/eureka"
- application = "default"
- weight = "1"
- }
- redis {
- serverAddr = "localhost:6379"
- db = "0"
- }
- zk {
- cluster = "default"
- serverAddr = "127.0.0.1:2181"
- session.timeout = 6000
- connect.timeout = 2000
- }
file {
name = "file.conf"
}
}
-
config {
- # file、zk
type = "file"
-
- zk {
- serverAddr = "127.0.0.1:2181"
- session.timeout = 6000
- connect.timeout = 2000
- }
file {
name = "file.conf"
}
diff --git a/pom.xml b/pom.xml
index 42ac05bbf2a..bdfe3f870b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -96,7 +96,7 @@
<narayana.version>5.12.7.Final</narayana.version>
<jboss-transaction-spi.version>7.6.1.Final</jboss-transaction-spi.version>
<jboss-logging.version>3.2.1.Final</jboss-logging.version>
- <seata.version>2.1.0</seata.version>
+ <seata.version>2.2.0</seata.version>
<netty.version>4.1.112.Final</netty.version>
<bouncycastle.version>1.78.1</bouncycastle.version>
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
index 37a78afc037..117329f8028 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
@@ -74,8 +74,6 @@ public final class TestShardingService {
/**
* Process success in ClickHouse.
- * ClickHouse has not fully supported transactions. Refer to <a
href="https://github.com/ClickHouse/clickhouse-docs/issues/2300">ClickHouse/clickhouse-docs#2300</a>.
- * So ShardingSphere should not use {@link
OrderItemRepository#assertRollbackWithTransactions()} in the method here.
*
* @throws SQLException An exception that provides information on a
database access error or other errors.
*/
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
index b24a06dac8f..a4faab5d693 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/ClickHouseTest.java
@@ -58,7 +58,7 @@ class ClickHouseTest {
private static final Network NETWORK = Network.newNetwork();
@Container
- private static final GenericContainer<?> CLICKHOUSE_KEEPER_CONTAINER = new
GenericContainer<>("clickhouse/clickhouse-keeper:24.10.2.80")
+ private static final GenericContainer<?> CLICKHOUSE_KEEPER_CONTAINER = new
GenericContainer<>("clickhouse/clickhouse-keeper:24.11.1.2557")
.withCopyFileToContainer(
MountableFile.forHostPath(Paths.get("src/test/resources/test-native/xml/keeper_config.xml").toAbsolutePath()),
"/etc/clickhouse-keeper/keeper_config.xml")
@@ -66,7 +66,7 @@ class ClickHouseTest {
.withNetworkAliases("clickhouse-keeper-01");
@Container
- public static final ClickHouseContainer CONTAINER = new
ClickHouseContainer("clickhouse/clickhouse-server:24.10.2.80")
+ public static final ClickHouseContainer CONTAINER = new
ClickHouseContainer("clickhouse/clickhouse-server:24.11.1.2557")
.withCopyFileToContainer(
MountableFile.forHostPath(Paths.get("src/test/resources/test-native/xml/transactions.xml").toAbsolutePath()),
"/etc/clickhouse-server/config.d/transactions.xml")
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
index d30d320ec7e..33b8965aa7b 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/transactions/base/SeataTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.test.natived.jdbc.transactions.base;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
-import org.apache.http.HttpStatus;
+import org.apache.hc.core5.http.HttpStatus;
import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
import org.apache.shardingsphere.test.natived.commons.TestShardingService;
import org.junit.jupiter.api.AfterAll;
@@ -46,7 +46,7 @@ class SeataTest {
@SuppressWarnings("resource")
@Container
- public static final GenericContainer<?> CONTAINER = new
GenericContainer<>("apache/seata-server:2.1.0")
+ public static final GenericContainer<?> CONTAINER = new
GenericContainer<>("apache/seata-server:2.2.0")
.withExposedPorts(7091, 8091)
.waitingFor(Wait.forHttp("/health")
.forPort(7091)
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/features/ShardingTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/MySQLTest.java
similarity index 98%
rename from
test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/features/ShardingTest.java
rename to
test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/MySQLTest.java
index 3b318ea4f55..f5a767f76db 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/features/ShardingTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/MySQLTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.natived.proxy.features;
+package org.apache.shardingsphere.test.natived.proxy.databases;
import com.mysql.cj.jdbc.exceptions.CommunicationsException;
import com.zaxxer.hikari.HikariConfig;
@@ -43,7 +43,7 @@ import java.util.Properties;
@SuppressWarnings({"SqlNoDataSourceInspection", "SameParameterValue",
"resource"})
@EnabledInNativeImage
@Testcontainers
-class ShardingTest {
+class MySQLTest {
@Container
public static final GenericContainer<?> MYSQL_CONTAINER = new
GenericContainer<>("mysql:9.1.0-oraclelinux9")
@@ -68,7 +68,7 @@ class ShardingTest {
statement.executeUpdate("CREATE DATABASE demo_ds_1");
statement.executeUpdate("CREATE DATABASE demo_ds_2");
}
- String absolutePath =
Paths.get("src/test/resources/test-native/yaml/proxy/features/sharding").toAbsolutePath().toString();
+ String absolutePath =
Paths.get("src/test/resources/test-native/yaml/proxy/databases/mysql").toAbsolutePath().toString();
proxyTestingServer = new ProxyTestingServer(absolutePath);
Awaitility.await().atMost(Duration.ofSeconds(30L)).ignoreExceptionsMatching(e
-> e instanceof CommunicationsException).until(() -> {
openConnection("root", "root", "jdbc:mysql://127.0.0.1:" +
proxyTestingServer.getProxyPort()).close();
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
index 4e5413aba1a..0be3680e223 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
@@ -26,7 +26,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;
-import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
@@ -39,15 +39,13 @@ import java.sql.Statement;
import java.time.Duration;
import java.util.Properties;
-@SuppressWarnings({"SqlNoDataSourceInspection", "SameParameterValue",
"resource"})
+@SuppressWarnings("SqlNoDataSourceInspection")
@EnabledInNativeImage
@Testcontainers
class PostgresTest {
@Container
- public static final GenericContainer<?> POSTGRES_CONTAINER = new
GenericContainer<>("postgres:17.1-bookworm")
- .withEnv("POSTGRES_PASSWORD", "yourStrongPassword123!")
- .withExposedPorts(5432);
+ public static final PostgreSQLContainer<?> POSTGRES_CONTAINER = new
PostgreSQLContainer<>("postgres:17.2-bookworm");
private static ProxyTestingServer proxyTestingServer;
@@ -56,12 +54,12 @@ class PostgresTest {
@BeforeAll
static void beforeAll() throws SQLException {
Awaitility.await().atMost(Duration.ofSeconds(30L)).ignoreExceptions().until(()
-> {
- openConnection("postgres", "yourStrongPassword123!",
"jdbc:postgresql://127.0.0.1:" + POSTGRES_CONTAINER.getMappedPort(5432) + "/")
+ openConnection("test", "test", "jdbc:postgresql://127.0.0.1:" +
POSTGRES_CONTAINER.getMappedPort(5432) + "/")
.close();
return true;
});
try (
- Connection connection = openConnection("postgres",
"yourStrongPassword123!", "jdbc:postgresql://127.0.0.1:" +
POSTGRES_CONTAINER.getMappedPort(5432) + "/");
+ Connection connection = openConnection("test", "test",
"jdbc:postgresql://127.0.0.1:" + POSTGRES_CONTAINER.getMappedPort(5432) + "/");
Statement statement = connection.createStatement()) {
statement.executeUpdate("CREATE DATABASE demo_ds_0");
statement.executeUpdate("CREATE DATABASE demo_ds_1");
@@ -99,16 +97,16 @@ class PostgresTest {
Statement statement = connection.createStatement()) {
statement.execute("REGISTER STORAGE UNIT ds_0 (\n"
+ " URL=\"jdbc:postgresql://127.0.0.1:" +
POSTGRES_CONTAINER.getMappedPort(5432) + "/demo_ds_0\",\n"
- + " USER=\"postgres\",\n"
- + " PASSWORD=\"yourStrongPassword123!\"\n"
+ + " USER=\"test\",\n"
+ + " PASSWORD=\"test\"\n"
+ "),ds_1 (\n"
+ " URL=\"jdbc:postgresql://127.0.0.1:" +
POSTGRES_CONTAINER.getMappedPort(5432) + "/demo_ds_1\",\n"
- + " USER=\"postgres\",\n"
- + " PASSWORD=\"yourStrongPassword123!\"\n"
+ + " USER=\"test\",\n"
+ + " PASSWORD=\"test\"\n"
+ "),ds_2 (\n"
+ " URL=\"jdbc:postgresql://127.0.0.1:" +
POSTGRES_CONTAINER.getMappedPort(5432) + "/demo_ds_2\",\n"
- + " USER=\"postgres\",\n"
- + " PASSWORD=\"yourStrongPassword123!\"\n"
+ + " USER=\"test\",\n"
+ + " PASSWORD=\"test\"\n"
+ ")");
statement.execute("CREATE DEFAULT SHARDING DATABASE STRATEGY (\n"
+ " TYPE=\"standard\", \n"
diff --git
a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json
b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json
index 44c372fa4dd..6ac73f1ee11 100644
---
a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json
+++
b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reflect-config.json
@@ -10,8 +10,8 @@
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
-
"condition":{"typeReachable":"org.apache.shardingsphere.test.natived.proxy.features.ShardingTest"},
- "name":"org.apache.shardingsphere.test.natived.proxy.features.ShardingTest",
+
"condition":{"typeReachable":"org.apache.shardingsphere.test.natived.proxy.databases.MySQLTest"},
+ "name":"org.apache.shardingsphere.test.natived.proxy.databases.MySQLTest",
"allDeclaredConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
diff --git a/test/native/src/test/resources/logback-test.xml
b/test/native/src/test/resources/logback-test.xml
index 5367fd2b1a3..7eaf3a36e35 100644
--- a/test/native/src/test/resources/logback-test.xml
+++ b/test/native/src/test/resources/logback-test.xml
@@ -26,7 +26,6 @@
<logger name="org.apache.shardingsphere" level="warn" additivity="false">
<appender-ref ref="console" />
</logger>
-
<root>
<level value="error" />
<appender-ref ref="console" />
diff --git a/test/native/src/test/resources/seata-script-client-conf-file.conf
b/test/native/src/test/resources/seata-script-client-conf-file.conf
index 28a355c0ca7..f5700207f5b 100644
--- a/test/native/src/test/resources/seata-script-client-conf-file.conf
+++ b/test/native/src/test/resources/seata-script-client-conf-file.conf
@@ -20,3 +20,9 @@
service {
vgroupMapping.default_tx_group = "default"
}
+# TODO This is not a reasonable configuration, just affected by
https://github.com/apache/incubator-seata/pull/6661. Pending investigation.
+client {
+ rm {
+ tableMetaCheckEnable = "false"
+ }
+}
diff --git
a/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
b/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
index 9d240e0381e..5f07dd12e62 100644
---
a/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
+++
b/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
@@ -19,15 +19,15 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.1-bookworm://test-native-databases-postgres/demo_ds_0
+ jdbcUrl:
jdbc:tc:postgresql:17.2-bookworm://test-native-databases-postgres/demo_ds_0
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.1-bookworm://test-native-databases-postgres/demo_ds_1
+ jdbcUrl:
jdbc:tc:postgresql:17.2-bookworm://test-native-databases-postgres/demo_ds_1
ds_2:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.1-bookworm://test-native-databases-postgres/demo_ds_2
+ jdbcUrl:
jdbc:tc:postgresql:17.2-bookworm://test-native-databases-postgres/demo_ds_2
rules:
- !SHARDING
diff --git
a/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
b/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
index 750f452a776..25e5a31fc8c 100644
---
a/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
+++
b/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
@@ -19,15 +19,15 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.1-bookworm://test-native-transactions-base/demo_ds_0?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
+ jdbcUrl:
jdbc:tc:postgresql:17.2-bookworm://test-native-transactions-base/demo_ds_0?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.1-bookworm://test-native-transactions-base/demo_ds_1?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
+ jdbcUrl:
jdbc:tc:postgresql:17.2-bookworm://test-native-transactions-base/demo_ds_1?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
ds_2:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.1-bookworm://test-native-transactions-base/demo_ds_2?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
+ jdbcUrl:
jdbc:tc:postgresql:17.2-bookworm://test-native-transactions-base/demo_ds_2?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
rules:
- !SHARDING
diff --git
a/test/native/src/test/resources/test-native/yaml/proxy/features/sharding/global.yaml
b/test/native/src/test/resources/test-native/yaml/proxy/databases/mysql/global.yaml
similarity index 92%
rename from
test/native/src/test/resources/test-native/yaml/proxy/features/sharding/global.yaml
rename to
test/native/src/test/resources/test-native/yaml/proxy/databases/mysql/global.yaml
index 5572ece5c27..28b6e40b4da 100644
---
a/test/native/src/test/resources/test-native/yaml/proxy/features/sharding/global.yaml
+++
b/test/native/src/test/resources/test-native/yaml/proxy/databases/mysql/global.yaml
@@ -15,10 +15,6 @@
# limitations under the License.
#
-mode:
- type: Standalone
- repository:
- type: JDBC
authority:
users:
- user: root@%
@@ -26,5 +22,4 @@ authority:
privilege:
type: ALL_PERMITTED
props:
- sql-show: false
proxy-frontend-database-protocol-type: MySQL
diff --git
a/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql/global.yaml
b/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql/global.yaml
index 164a86b1095..b64e7dcac9c 100644
---
a/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql/global.yaml
+++
b/test/native/src/test/resources/test-native/yaml/proxy/databases/postgresql/global.yaml
@@ -26,5 +26,4 @@ authority:
privilege:
type: ALL_PERMITTED
props:
- sql-show: false
proxy-frontend-database-protocol-type: PostgreSQL