Skip to content

Commit b575220

Browse files
committed
Removes support for jdbcURL prefix of jdbc:tc:shardingsphere0clickhouse:
1 parent 5a85a20 commit b575220

19 files changed

Lines changed: 193 additions & 188 deletions

File tree

RELEASE-NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### API Changes
44

5+
1. Infra: Removes support for jdbcURL prefix of `jdbc:tc:shardingsphere0clickhouse:` - [#33707](https://github.com/apache/shardingsphere/pull/33707)
6+
57
### New Features
68

79
### Enhancements

docs/document/content/user-manual/common-config/builtin-algorithm/expr.cn.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ Truffle 与 JDK 的向后兼容性矩阵位于 https://medium.com/graalvm/40027a
122122
考虑一个简单的 SPI 实现类,
123123

124124
```java
125+
package org.example;
125126
import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser;
126127
import java.util.Arrays;
127128
import java.util.List;
@@ -146,6 +147,12 @@ public final class CustomInlineExpressionParserFixture implements InlineExpressi
146147
}
147148
```
148149

150+
并在项目的 classpath 添加 `META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser`文件,
151+
152+
```
153+
org.example.CustomInlineExpressionParserFixture
154+
```
155+
149156
此时对于 ShardingSphere 配置文件中的 `actualDataNodes`
150157
1. 若配置为 `<CUSTOM.FIXTURE>spring`,将被转化为 `t_order_2024_01, t_order_2024_02`
151158
2. 若配置为 `<CUSTOM.FIXTURE>summer`,将被转化为 `t_order_2024_03, t_order_2024_04`

docs/document/content/user-manual/common-config/builtin-algorithm/expr.en.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ public final class CustomInlineExpressionParserFixture implements InlineExpressi
159159
}
160160
```
161161

162+
And add the file `META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser` to the project classpath,
163+
164+
```
165+
org.example.CustomInlineExpressionParserFixture
166+
```
167+
162168
At this time, for `actualDataNodes` in the ShardingSphere configuration file,
163169
1. If configured as `<CUSTOM.FIXTURE>spring`, it will be converted to `t_order_2024_01, t_order_2024_02`.
164170
2. If configured as `<CUSTOM.FIXTURE>summer`, it will be converted to `t_order_2024_03, t_order_2024_04`.

docs/document/content/user-manual/common-config/builtin-algorithm/sharding.cn.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
9696

9797
可配置属性:
9898

99-
| *属性名称* | *数据类型* | *说明* | *默认值* |
100-
|------------------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------|-------|
101-
| datetime-pattern | String | 分片键的时间戳格式,必须遵循 Java DateTimeFormatter 的格式。例如:yyyy-MM-dd HH:mm:ss,yyyy-MM-dd 或 HH:mm:ss 等。但不支持与 `java.time.chrono.JapaneseDate` 相关的 Gy-MM 等 | |
102-
| datetime-lower | String | 时间分片下界值,格式与 `datetime-pattern` 定义的时间戳格式一致 | |
103-
| datetime-upper (?) | String | 时间分片上界值,格式与 `datetime-pattern` 定义的时间戳格式一致 | 当前时间 |
104-
| sharding-suffix-pattern | String | 分片数据源或真实表的后缀格式,必须遵循 Java DateTimeFormatter 的格式,必须和 `datetime-interval-unit` 保持一致。例如:yyyyMM | |
105-
| datetime-interval-amount (?) | int | 分片键时间间隔,超过该时间间隔将进入下一分片 | 1 |
106-
| datetime-interval-unit (?) | String | 分片键时间间隔单位,必须遵循 Java ChronoUnit 的枚举值。例如:MONTHS | DAYS |
99+
| *属性名称* | *数据类型* | *说明* | *默认值* |
100+
|------------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------|-------|
101+
| datetime-pattern | String | 分片键的时间戳格式,必须遵循 Java DateTimeFormatter 的格式。例如:yyyy-MM-dd HH:mm:ss,yyyy-MM-dd 或 HH:mm:ss 等。但不支持与 `java.time.chrono.JapaneseDate` 相关的 GGGGy-MM 等 | |
102+
| datetime-lower | String | 时间分片下界值,格式与 `datetime-pattern` 定义的时间戳格式一致 | |
103+
| datetime-upper (?) | String | 时间分片上界值,格式与 `datetime-pattern` 定义的时间戳格式一致 | 当前时间 |
104+
| sharding-suffix-pattern | String | 分片数据源或真实表的后缀格式,必须遵循 Java DateTimeFormatter 的格式,必须和 `datetime-interval-unit` 保持一致。例如:yyyyMM | |
105+
| datetime-interval-amount (?) | int | 分片键时间间隔,超过该时间间隔将进入下一分片 | 1 |
106+
| datetime-interval-unit (?) | String | 分片键时间间隔单位,必须遵循 Java ChronoUnit 的枚举值。例如:MONTHS | DAYS |
107107

108108
### 复合分片算法
109109

docs/document/content/user-manual/common-config/builtin-algorithm/sharding.en.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ Type: INTERVAL
100100

101101
Attributes:
102102

103-
| *Name* | *DataType* | *Description* | *Default Value* |
104-
|------------------------------|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
105-
| datetime-pattern | String | Timestamp pattern of sharding value, must can be transformed to Java LocalDateTime. For example: yyyy-MM-dd HH:mm:ss, yyyy-MM-dd or HH:mm:ss etc. But Gy-MM etc. related to `java.time.chrono.JapaneseDate` are not supported | - |
106-
| datetime-lower | String | Datetime sharding lower boundary, pattern is defined `datetime-pattern` | - |
107-
| datetime-upper (?) | String | Datetime sharding upper boundary, pattern is defined `datetime-pattern` | Now |
108-
| sharding-suffix-pattern | String | Suffix pattern of sharding data sources or tables, must can be transformed to Java LocalDateTime, must be consistent with `datetime-interval-unit`. For example: yyyyMM | - |
109-
| datetime-interval-amount (?) | int | Interval of sharding value, after which the next shard will be entered | 1 |
110-
| datetime-interval-unit (?) | String | Unit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS | DAYS |
103+
| *Name* | *DataType* | *Description* | *Default Value* |
104+
|------------------------------|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
105+
| datetime-pattern | String | Timestamp pattern of sharding value, must can be transformed to Java LocalDateTime. For example: yyyy-MM-dd HH:mm:ss, yyyy-MM-dd or HH:mm:ss etc. But GGGGy-MM etc. related to `java.time.chrono.JapaneseDate` are not supported | - |
106+
| datetime-lower | String | Datetime sharding lower boundary, pattern is defined `datetime-pattern` | - |
107+
| datetime-upper (?) | String | Datetime sharding upper boundary, pattern is defined `datetime-pattern` | Now |
108+
| sharding-suffix-pattern | String | Suffix pattern of sharding data sources or tables, must can be transformed to Java LocalDateTime, must be consistent with `datetime-interval-unit`. For example: yyyyMM | - |
109+
| datetime-interval-amount (?) | int | Interval of sharding value, after which the next shard will be entered | 1 |
110+
| datetime-interval-unit (?) | String | Unit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS | DAYS |
111111

112112
### Complex Sharding Algorithm
113113

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@
338338

339339
<profiles>
340340
<profile>
341-
<id>jdk11-22</id>
341+
<id>jdk11+</id>
342342
<activation>
343343
<jdk>[11,)</jdk>
344344
</activation>

infra/database/type/testcontainers/src/main/java/org/apache/shardingsphere/infra/database/testcontainers/type/TcClickHouseDatabaseType.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,18 @@
2020
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
2121
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
2222

23-
import java.util.Arrays;
2423
import java.util.Collection;
24+
import java.util.Collections;
2525
import java.util.Optional;
2626

2727
/**
2828
* Database type of ClickHouse in testcontainers-java.
2929
*/
3030
public final class TcClickHouseDatabaseType implements TestcontainersDatabaseType {
3131

32-
/**
33-
* TODO See the JavaDoc for `org.apache.shardingsphere.test.natived.jdbc.commons.testcontainers.ClickHouseProvider`.
34-
*
35-
* @return prefixes of JDBC URL
36-
*/
3732
@Override
3833
public Collection<String> getJdbcUrlPrefixes() {
39-
return Arrays.asList("jdbc:tc:clickhouse:", "jdbc:tc:shardingsphere0clickhouse:");
34+
return Collections.singletonList("jdbc:tc:clickhouse:");
4035
}
4136

4237
@Override

infra/database/type/testcontainers/src/test/java/org/apache/shardingsphere/infra/database/testcontainers/type/TestcontainersDatabaseTypeTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
2222
import org.junit.jupiter.api.Test;
2323

24-
import java.util.Arrays;
2524
import java.util.Collections;
2625

2726
import static org.hamcrest.CoreMatchers.is;
@@ -31,7 +30,7 @@ class TestcontainersDatabaseTypeTest {
3130

3231
@Test
3332
void assertGetJdbcUrlPrefixes() {
34-
assertThat(TypedSPILoader.getService(DatabaseType.class, "TC-ClickHouse").getJdbcUrlPrefixes(), is(Arrays.asList("jdbc:tc:clickhouse:", "jdbc:tc:shardingsphere0clickhouse:")));
33+
assertThat(TypedSPILoader.getService(DatabaseType.class, "TC-ClickHouse").getJdbcUrlPrefixes(), is(Collections.singletonList("jdbc:tc:clickhouse:")));
3534
assertThat(TypedSPILoader.getService(DatabaseType.class, "TC-MariaDB").getJdbcUrlPrefixes(), is(Collections.singleton("jdbc:tc:mariadb:")));
3635
assertThat(TypedSPILoader.getService(DatabaseType.class, "TC-MySQL").getJdbcUrlPrefixes(), is(Collections.singleton("jdbc:tc:mysql:")));
3736
assertThat(TypedSPILoader.getService(DatabaseType.class, "TC-Oracle").getJdbcUrlPrefixes(), is(Collections.singleton("jdbc:tc:oracle:")));

infra/reachability-metadata/src/main/resources/META-INF/native-image/com.clickhouse/clickhouse-jdbc/0.6.3/resource-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
"includes":[{
44
"condition":{"typeReachable":"com.clickhouse.logging.LoggerFactory"},
55
"pattern":"\\QMETA-INF/services/com.clickhouse.logging.LoggerFactory\\E"
6+
}, {
7+
"condition":{"typeReachable":"com.clickhouse.client.ClickHouseRequestManager"},
8+
"pattern":"\\QMETA-INF/services/com.clickhouse.client.ClickHouseRequestManager\\E"
9+
}, {
10+
"condition":{"typeReachable":"com.clickhouse.data.ClickHouseDataStreamFactory"},
11+
"pattern":"\\QMETA-INF/services/com.clickhouse.data.ClickHouseDataStreamFactory\\E"
12+
}, {
13+
"condition":{"typeReachable":"com.clickhouse.jdbc.JdbcTypeMapping"},
14+
"pattern":"\\QMETA-INF/services/com.clickhouse.jdbc.JdbcTypeMapping\\E"
15+
}, {
16+
"condition":{"typeReachable":"com.clickhouse.client.internal.jpountz.lz4.LZ4JNI"},
17+
"pattern":"\\Qcom/clickhouse/client/internal/jpountz/util/linux/amd64/liblz4-java.so\\E"
618
}]},
719
"bundles":[]
820
}

infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
6161
},
6262
{
63-
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.persist.StandaloneMetaDataManagerPersistService"},
63+
"condition":{"typeReachable":"org.apache.shardingsphere.metadata.persist.service.version.MetaDataVersionPersistService"},
6464
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
6565
},
6666
{
@@ -176,6 +176,11 @@
176176
"queryAllDeclaredMethods":true,
177177
"methods":[{"name":"close","parameterTypes":[] }, {"name":"read","parameterTypes":["java.nio.CharBuffer"] }]
178178
},
179+
{
180+
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource"},
181+
"name":"java.io.Serializable",
182+
"queryAllDeclaredMethods":true
183+
},
179184
{
180185
"condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"},
181186
"name":"java.io.Serializable",
@@ -468,11 +473,6 @@
468473
"condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"},
469474
"name":"java.net.Socket"
470475
},
471-
{
472-
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource"},
473-
"name":"java.net.SocketException",
474-
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
475-
},
476476
{
477477
"condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"},
478478
"name":"java.net.URI"
@@ -1103,7 +1103,7 @@
11031103
"methods":[{"name":"<init>","parameterTypes":[] }]
11041104
},
11051105
{
1106-
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.connector.DatabaseConnector"},
1106+
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.connector.StandardDatabaseConnector"},
11071107
"name":"org.apache.shardingsphere.encrypt.checker.sql.EncryptSupportedSQLCheckersBuilder",
11081108
"methods":[{"name":"<init>","parameterTypes":[] }]
11091109
},
@@ -2070,7 +2070,7 @@
20702070
"queryAllDeclaredMethods":true
20712071
},
20722072
{
2073-
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.listener.DatabaseMetaDataChangedListener$$Lambda/0x00007f490fb226e0"},
2073+
"condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.cluster.listener.DatabaseMetaDataChangedListener$$Lambda/0x00007ffa47b22d00"},
20742074
"name":"org.apache.shardingsphere.mode.manager.cluster.event.subscriber.dispatch.MetaDataChangedSubscriber"
20752075
},
20762076
{
@@ -2417,10 +2417,6 @@
24172417
"condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader"},
24182418
"name":"org.apache.shardingsphere.readwritesplitting.checker.ReadwriteSplittingRuleConfigurationChecker"
24192419
},
2420-
{
2421-
"condition":{"typeReachable":"org.apache.shardingsphere.infra.datanode.DataNodes"},
2422-
"name":"org.apache.shardingsphere.readwritesplitting.datanode.ReadwriteSplittingDataNodeBuilder"
2423-
},
24242420
{
24252421
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor"},
24262422
"name":"org.apache.shardingsphere.readwritesplitting.distsql.handler.update.AlterReadwriteSplittingRuleExecutor"
@@ -2548,10 +2544,6 @@
25482544
"condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader"},
25492545
"name":"org.apache.shardingsphere.shadow.checker.ShadowRuleConfigurationChecker"
25502546
},
2551-
{
2552-
"condition":{"typeReachable":"org.apache.shardingsphere.infra.datanode.DataNodes"},
2553-
"name":"org.apache.shardingsphere.shadow.datanode.ShadowDataNodeBuilder"
2554-
},
25552547
{
25562548
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor"},
25572549
"name":"org.apache.shardingsphere.shadow.distsql.handler.update.AlterDefaultShadowAlgorithmExecutor"
@@ -3602,5 +3594,10 @@
36023594
{
36033595
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.initializer.BootstrapInitializer"},
36043596
"name":"org.apache.shardingsphere.transaction.yaml.config.YamlTransactionRuleConfigurationCustomizer"
3597+
},
3598+
{
3599+
"condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine"},
3600+
"name":"sun.security.provider.SecureRandom",
3601+
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"<init>","parameterTypes":["java.security.SecureRandomParameters"] }]
36053602
}
36063603
]

0 commit comments

Comments
 (0)