Skip to content

Commit

Permalink
Bump the minimum Seata Client version for Seata AT integration to 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian committed Dec 2, 2024
1 parent 60fae79 commit 8f9be44
Show file tree
Hide file tree
Showing 31 changed files with 559 additions and 272 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 提供支持,
Expand All @@ -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,
示例如下,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:`
Expand All @@ -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,

Expand Down
Loading

0 comments on commit 8f9be44

Please sign in to comment.