-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathold_version_ss
451 lines (435 loc) · 20.2 KB
/
old_version_ss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
commit ec5380bed28be29f62066273e2568f979e302825
Author: Ling Hengqian <linghengqian@outlook.com>
Date: Fri Jan 31 17:26:58 2025 +0800
Remove the test of Local transactions for ClickHouse integration module in nativeTest (#34530)
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
index f18270218c9..4f447442012 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
@@ -389,11 +389,11 @@ Reachability Metadata 位于 `shardingsphere-infra-reachability-metadata` 子模
```bash
git clone git@github.com:apache/shardingsphere.git
cd ./shardingsphere/
-./mvnw -PgenerateMetadata -DskipNativeTests -e -T 1C clean test native:metadata-copy
+./mvnw -PgenerateMetadata -e -T 1C clean test native:metadata-copy
```
受 https://github.com/apache/shardingsphere/issues/33206 影响,
-贡献者执行 `./mvnw -PgenerateMetadata -DskipNativeTests -T 1C -e clean test native:metadata-copy` 后,
+贡献者执行 `./mvnw -PgenerateMetadata -T 1C -e clean test native:metadata-copy` 后,
`infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json` 会生成不必要的包含绝对路径的 JSON 条目,
类似如下,
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
index 8ebe31f5e42..70626b881ae 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
@@ -405,11 +405,11 @@ contributors should place it on the classpath of the `shardingsphere-test-native
```bash
git clone git@github.com:apache/shardingsphere.git
cd ./shardingsphere/
-./mvnw -PgenerateMetadata -DskipNativeTests -e -T 1C clean test native:metadata-copy
+./mvnw -PgenerateMetadata -e -T 1C clean test native:metadata-copy
```
Affected by https://github.com/apache/shardingsphere/issues/33206 ,
-After the contributor executes `./mvnw -PgenerateMetadata -DskipNativeTests -T 1C -e clean test native:metadata-copy`,
+After the contributor executes `./mvnw -PgenerateMetadata -T 1C -e clean test native:metadata-copy`,
`infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/resource-config.json` will generate unnecessary JSON entries containing absolute paths,
similar to the following.
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 9e12705225b..a9594b8f1fc 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
@@ -213,182 +213,12 @@ public class ExampleTest {
### 事务限制
-ClickHouse 不支持 ShardingSphere 集成级别的 XA 事务,
-因为 https://github.com/ClickHouse/clickhouse-java 未实现 `javax.sql.XADataSource` 的相关 Java 接口。
-
-ClickHouse 不支持 ShardingSphere 集成级别的 Seata AT 模式事务,
-因为 https://github.com/apache/incubator-seata 未实现 ClickHouse 的 SQL 方言解析。
-
-ClickHouse 支持 ShardingSphere 集成级别的本地事务,但需要对 ClickHouse 进行额外配置,
+ClickHouse 不支持 ShardingSphere 集成级别的本地事务,XA 事务或 Seata 的 AT 模式事务,
更多讨论位于 https://github.com/ClickHouse/clickhouse-docs/issues/2300 。
-引入讨论,编写 Docker Compose 文件来启动 ClickHouse 和 ClickHouse Keeper。
-
-```yaml
-services:
- clickhouse-keeper-01:
- 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.11.1.2557
- depends_on:
- - clickhouse-keeper-01
- ports:
- - "8123:8123"
- volumes:
- - ./transactions.xml:/etc/clickhouse-server/config.d/transactions.xml
-```
-
-`./keeper_config.xml` 的内容如下,
-
-```xml
-<clickhouse replace="true">
- <listen_host>0.0.0.0</listen_host>
- <keeper_server>
- <tcp_port>9181</tcp_port>
- <server_id>1</server_id>
- <snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>
- <raft_configuration>
- <server>
- <id>1</id>
- <hostname>clickhouse-keeper-01</hostname>
- <port>9234</port>
- </server>
- </raft_configuration>
- </keeper_server>
-</clickhouse>
-```
-
-`./transactions.xml` 的内容如下,
-
-```xml
-<clickhouse>
- <allow_experimental_transactions>1</allow_experimental_transactions>
- <zookeeper>
- <node index="1">
- <host>clickhouse-keeper-01</host>
- <port>9181</port>
- </node>
- </zookeeper>
-</clickhouse>
-```
-
-在 DBeaver Community 内,使用 `jdbc:ch://localhost:8123/default` 的 `jdbcUrl`,`default` 的`username` 连接至 ClickHouse,
-`password` 留空。
-执行如下 SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE DATABASE demo_ds_0;
-CREATE DATABASE demo_ds_1;
-CREATE DATABASE demo_ds_2;
-```
-
-分别使用 `jdbc:ch://localhost:8123/demo_ds_0` ,
-`jdbc:ch://localhost:8123/demo_ds_1` 和 `jdbc:ch://localhost:8123/demo_ds_2` 的 `jdbcUrl` 连接至 ClickHouse 来执行如下 SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-create table IF NOT EXISTS t_order (
- order_id Int64 NOT NULL,
- order_type Int32,
- user_id Int32 NOT NULL,
- address_id Int64 NOT NULL,
- status VARCHAR(50)
-) engine = MergeTree
- primary key (order_id)
- order by (order_id);
-
-TRUNCATE TABLE t_order;
-```
-
-在业务项目引入`前提条件`涉及的依赖后,在业务项目的 classpath 上编写 ShardingSphere 数据源的配置文件`demo.yaml`,
-
-```yaml
-dataSources:
- ds_0:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.clickhouse.jdbc.ClickHouseDriver
- jdbcUrl: jdbc:ch://localhost:8123/demo_ds_0?transactionSupport=true
- username: default
- password:
- ds_1:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.clickhouse.jdbc.ClickHouseDriver
- jdbcUrl: jdbc:ch://localhost:8123/demo_ds_1?transactionSupport=true
- username: default
- password:
- ds_2:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.clickhouse.jdbc.ClickHouseDriver
- jdbcUrl: jdbc:ch://localhost:8123/demo_ds_2?transactionSupport=true
- username: default
- password:
-rules:
-- !SHARDING
- tables:
- t_order:
- actualDataNodes:
- 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
-```
-
-创建 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 ExampleUtils {
- 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); Connection connection = dataSource.getConnection()) {
- try {
- connection.setAutoCommit(false);
- connection.createStatement().executeUpdate("INSERT INTO t_order (user_id, order_type, address_id, status) VALUES (2024, 0, 2024, 'INSERT_TEST')");
- connection.createStatement().executeUpdate("INSERT INTO t_order_does_not_exist (test_id_does_not_exist) VALUES (2024)");
- connection.commit();
- } catch (final SQLException ignored) {
- connection.rollback();
- } finally {
- connection.setAutoCommit(true);
- }
- try (Connection conn = dataSource.getConnection()) {
- assert !conn.createStatement().executeQuery("SELECT * FROM t_order WHERE user_id = 2024").next();
- }
- }
- }
-}
-```
-
-一旦在 ShardingSphere 的配置文件为 ClickHouse JDBC Driver 的 jdbcUrl 设置 `transactionSupport=true`,
-用户在执行 `alter table` 语句前应确保没有尚未完成执行的 `insert` 语句,以避免如下 Error 的发生,
-
-```shell
-java.sql.BatchUpdateException: Code: 341. DB::Exception: Exception happened during execution of mutation 'mutation_6.txt' with part 'all_1_1_0' reason: 'Serialization error: part all_1_1_0 is locked by transaction 5672402456378293316'. This error maybe retryable or not. In case of unretryable error, mutation can be killed with KILL MUTATION query. (UNFINISHED) (version 24.10.2.80 (official build))
- at com.clickhouse.jdbc.SqlExceptionUtils.batchUpdateError(SqlExceptionUtils.java:107)
- at com.clickhouse.jdbc.internal.SqlBasedPreparedStatement.executeAny(SqlBasedPreparedStatement.java:223)
- at com.clickhouse.jdbc.internal.SqlBasedPreparedStatement.executeLargeUpdate(SqlBasedPreparedStatement.java:302)
- at com.clickhouse.jdbc.internal.AbstractPreparedStatement.executeUpdate(AbstractPreparedStatement.java:135)
-```
+这与 https://clickhouse.com/docs/en/guides/developer/transactional 为 ClickHouse 提供的 `Transactions, Commit, and Rollback` 功能无关,
+仅与 `com.clickhouse.jdbc.ConnectionImpl` 未实现 `java.sql.Connection#rollback()` 有关。
+参考 https://github.com/ClickHouse/clickhouse-java/issues/2023 。
### 嵌入式 ClickHouse 限制
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 0e81b120748..d2a08b8ce26 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
@@ -219,182 +219,12 @@ public class ExampleTest {
### Transaction Limitations
-ClickHouse does not support XA transactions at the ShardingSphere integration level,
-because https://github.com/ClickHouse/clickhouse-java does not implement the relevant Java interface of `javax.sql.XADataSource`.
+ClickHouse does not support local transactions at the ShardingSphere integration level, XA transactions, or AT mode transactions for Seata,
+More discussion is at https://github.com/ClickHouse/clickhouse-docs/issues/2300 .
-ClickHouse does not support Seata AT mode transactions at the ShardingSphere integration level,
-because https://github.com/apache/incubator-seata does not implement ClickHouse's SQL dialect parsing.
-
-ClickHouse supports local transactions at the ShardingSphere integration level, but additional configuration of ClickHouse is required,
-For more discussion, please visit https://github.com/ClickHouse/clickhouse-docs/issues/2300 .
-
-Introduce the discussion of writing a Docker Compose file to start ClickHouse and ClickHouse Keeper.
-
-```yaml
-services:
- clickhouse-keeper-01:
- 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.11.1.2557
- depends_on:
- - clickhouse-keeper-01
- ports:
- - "8123:8123"
- volumes:
- - ./transactions.xml:/etc/clickhouse-server/config.d/transactions.xml
-```
-
-The content of `./keeper_config.xml` is as follows,
-
-```xml
-<clickhouse replace="true">
- <listen_host>0.0.0.0</listen_host>
- <keeper_server>
- <tcp_port>9181</tcp_port>
- <server_id>1</server_id>
- <snapshot_storage_path>/var/lib/clickhouse/coordination/snapshots</snapshot_storage_path>
- <raft_configuration>
- <server>
- <id>1</id>
- <hostname>clickhouse-keeper-01</hostname>
- <port>9234</port>
- </server>
- </raft_configuration>
- </keeper_server>
-</clickhouse>
-```
-
-The content of `./transactions.xml` is as follows,
-
-```xml
-<clickhouse>
- <allow_experimental_transactions>1</allow_experimental_transactions>
- <zookeeper>
- <node index="1">
- <host>clickhouse-keeper-01</host>
- <port>9181</port>
- </node>
- </zookeeper>
-</clickhouse>
-```
-
-In DBeaver Community, use `jdbcUrl` of `jdbc:ch://localhost:8123/default`, `username` of `default` to connect to ClickHouse,
-and leave `password` blank. Execute the following SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE DATABASE demo_ds_0;
-CREATE DATABASE demo_ds_1;
-CREATE DATABASE demo_ds_2;
-```
-
-Use `jdbcUrl` of `jdbc:ch://localhost:8123/demo_ds_0`, `jdbc:ch://localhost:8123/demo_ds_1`
-and `jdbc:ch://localhost:8123/demo_ds_2` to connect to ClickHouse and execute the following SQL.
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-create table IF NOT EXISTS t_order (
- order_id Int64 NOT NULL,
- order_type Int32,
- user_id Int32 NOT NULL,
- address_id Int64 NOT NULL,
- status VARCHAR(50)
-) engine = MergeTree
- primary key (order_id)
- order by (order_id);
-
-TRUNCATE TABLE t_order;
-```
-
-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.clickhouse.jdbc.ClickHouseDriver
- jdbcUrl: jdbc:ch://localhost:8123/demo_ds_0?transactionSupport=true
- username: default
- password:
- ds_1:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.clickhouse.jdbc.ClickHouseDriver
- jdbcUrl: jdbc:ch://localhost:8123/demo_ds_1?transactionSupport=true
- username: default
- password:
- ds_2:
- dataSourceClassName: com.zaxxer.hikari.HikariDataSource
- driverClassName: com.clickhouse.jdbc.ClickHouseDriver
- jdbcUrl: jdbc:ch://localhost:8123/demo_ds_2?transactionSupport=true
- username: default
- password:
-rules:
-- !SHARDING
- tables:
- t_order:
- actualDataNodes:
- 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
-```
-
-After creating the ShardingSphere data source, local transactions can be used normally.
-
-```java
-import com.zaxxer.hikari.HikariConfig;
-import com.zaxxer.hikari.HikariDataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-@SuppressWarnings({"SqlNoDataSourceInspection", "AssertWithSideEffects"})
-public class ExampleUtils {
- 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); Connection connection = dataSource.getConnection()) {
- try {
- connection.setAutoCommit(false);
- connection.createStatement().executeUpdate("INSERT INTO t_order (user_id, order_type, address_id, status) VALUES (2024, 0, 2024, 'INSERT_TEST')");
- connection.createStatement().executeUpdate("INSERT INTO t_order_does_not_exist (test_id_does_not_exist) VALUES (2024)");
- connection.commit();
- } catch (final SQLException ignored) {
- connection.rollback();
- } finally {
- connection.setAutoCommit(true);
- }
- try (Connection conn = dataSource.getConnection()) {
- assert !conn.createStatement().executeQuery("SELECT * FROM t_order WHERE user_id = 2024").next();
- }
- }
- }
-}
-```
-
-Once `transactionSupport=true` is set for the jdbcUrl of ClickHouse JDBC Driver in the ShardingSphere configuration file,
-users should ensure that there are no unfinished `insert` statements before executing the `alter table` statement to avoid the following Error.
-
-```shell
-java.sql.BatchUpdateException: Code: 341. DB::Exception: Exception happened during execution of mutation 'mutation_6.txt' with part 'all_1_1_0' reason: 'Serialization error: part all_1_1_0 is locked by transaction 5672402456378293316'. This error maybe retryable or not. In case of unretryable error, mutation can be killed with KILL MUTATION query. (UNFINISHED) (version 24.10.2.80 (official build))
- at com.clickhouse.jdbc.SqlExceptionUtils.batchUpdateError(SqlExceptionUtils.java:107)
- at com.clickhouse.jdbc.internal.SqlBasedPreparedStatement.executeAny(SqlBasedPreparedStatement.java:223)
- at com.clickhouse.jdbc.internal.SqlBasedPreparedStatement.executeLargeUpdate(SqlBasedPreparedStatement.java:302)
- at com.clickhouse.jdbc.internal.AbstractPreparedStatement.executeUpdate(AbstractPreparedStatement.java:135)
-```
+This has nothing to do with the `Transactions, Commit, and Rollback` feature provided by https://clickhouse.com/docs/en/guides/developer/transactional for ClickHouse,
+but only with `com.clickhouse.jdbc.ConnectionImpl` not implementing `java.sql.Connection#rollback()`.
+See https://github.com/ClickHouse/clickhouse-java/issues/2023 .
### Embedded ClickHouse Limitations
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md
index 28637148be3..4ec84b5cf42 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md
@@ -80,7 +80,7 @@ ShardingSphere 对 HiveServer2 JDBC Driver 的支持位于可选模块中。
<dependency>
<groupId>io.github.linghengqian</groupId>
<artifactId>hive-server2-jdbc-driver-thin</artifactId>
- <version>1.6.0</version>
+ <version>1.7.0</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.woodstox</groupId>
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md
index 4bc6a90939d..66ee9beccbf 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md
@@ -82,7 +82,7 @@ The following is an example of a possible configuration,
<dependency>
<groupId>io.github.linghengqian</groupId>
<artifactId>hive-server2-jdbc-driver-thin</artifactId>
- <version>1.6.0</version>
+ <version>1.7.0</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.woodstox</groupId>