You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/09/11 12:15:08 UTC
[shardingsphere] branch master updated: Add property documentation for CosIdModShardingAlgorithm, CosIdIntervalShardingAlgorithm and CosIdSnowflakeIntervalShardingAlgorithm (#20922)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 92c49788d1c Add property documentation for CosIdModShardingAlgorithm, CosIdIntervalShardingAlgorithm and CosIdSnowflakeIntervalShardingAlgorithm (#20922)
92c49788d1c is described below
commit 92c49788d1c3b60e2bc1bfcb3575ef3cb6a53eb7
Author: Ling Hengqian <li...@outlook.com>
AuthorDate: Sun Sep 11 20:15:00 2022 +0800
Add property documentation for CosIdModShardingAlgorithm, CosIdIntervalShardingAlgorithm and CosIdSnowflakeIntervalShardingAlgorithm (#20922)
---
.../common-config/builtin-algorithm/sharding.cn.md | 54 ++++++++++++++++
.../common-config/builtin-algorithm/sharding.en.md | 71 +++++++++++++++++++---
2 files changed, 117 insertions(+), 8 deletions(-)
diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.cn.md b/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.cn.md
index 09e9d1027dd..3fa70f0d2ca 100644
--- a/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.cn.md
+++ b/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.cn.md
@@ -21,6 +21,20 @@ ShardingSphere 内置提供了多种分片算法,按照类型可以划分为
| -------------- | -------- | ------ |
| sharding-count | int | 分片数量 |
+#### 基于 CosId 的取模分片算法
+
+基于 `me.ahoo.cosid:cosid-core` 的工具类实现的取模分片算法。
+参考 https://github.com/apache/shardingsphere/issues/14047 的讨论。
+
+类型:COSID_MOD
+
+可配置属性:
+
+| *属性名称* | *数据类型* | *说明* |
+|-------------------| -------- |------------------------|
+| mod | int | 分片数量 |
+| logic-name-prefix | String | 分片数据源或真实表的前缀格式 |
+
#### 哈希取模分片算法
类型:HASH_MOD
@@ -103,6 +117,46 @@ Apache ShardingSphere 内置的标准分片算法实现类包括:
| datetime-interval-amount (?) | int | 分片键时间间隔,超过该时间间隔将进入下一分片 | 1 |
| datetime-interval-unit (?) | String | 分片键时间间隔单位,必须遵循 Java ChronoUnit 的枚举值。例如:MONTHS | DAYS |
+#### 基于 CosId 的固定时间范围的分片算法
+
+基于 `me.ahoo.cosid:cosid-core` 的工具类实现的固定时间范围的分片算法。
+当分片键为 JSR-310 的所含类或与时间相关的类,将转换为`java.time.LocalDateTime`后再做下一步分片。
+参考 https://github.com/apache/shardingsphere/issues/14047 的讨论。
+
+类型:COSID_INTERVAL
+
+可配置属性:
+
+| *属性名称* | *数据类型* | *说明* | *默认值* |
+|--------------------------|---------|--------------------------------------------------------------------------------------------| ------- |
+| zone-id | String | 时区,必须遵循 `java.time.ZoneId` 的所含值。 例如:Asia/Shanghai | |
+| logic-name-prefix | String | 分片数据源或真实表的前缀格式 | |
+| datetime-lower | String | 时间分片下界值,格式与 `yyyy-MM-dd HH:mm:ss` 的时间戳格式一致 | |
+| datetime-upper | String | 时间分片上界值,格式与 `yyyy-MM-dd HH:mm:ss` 的时间戳格式一致 | |
+| sharding-suffix-pattern | String | 分片数据源或真实表的后缀格式,必须遵循 Java DateTimeFormatter 的格式,必须和 `datetime-interval-unit` 保持一致。例如:yyyyMM | |
+| datetime-interval-unit | String | 分片键时间间隔单位,必须遵循 Java ChronoUnit 的枚举值。例如:MONTHS | |
+| datetime-interval-amount | int | 分片键时间间隔,超过该时间间隔将进入下一分片 | |
+
+#### 基于 CosId 的雪花ID固定时间范围的分片算法
+
+基于 `me.ahoo.cosid:cosid-core` 的工具类实现的雪花ID固定时间范围的分片算法。
+当分片键为 JSR-310 的所含类或与时间相关的类,将转换为`java.time.LocalDateTime`后再做下一步分片。
+参考 https://github.com/apache/shardingsphere/issues/14047 的讨论。
+
+类型:COSID_INTERVAL_SNOWFLAKE
+
+可配置属性:
+
+| *属性名称* | *数据类型* | *说明* | *默认值* |
+|--------------------------|---------|---------------------------------------------------------------------------------------------------| ------- |
+| zone-id | String | 时区,必须遵循 `java.time.ZoneId` 的所含值。 例如:Asia/Shanghai | |
+| logic-name-prefix | String | 分片数据源或真实表的前缀格式 | |
+| datetime-lower | String | 时间分片下界值,格式与 `yyyy-MM-dd HH:mm:ss` 的时间戳格式一致 | |
+| datetime-upper | String | 时间分片上界值,格式与 `yyyy-MM-dd HH:mm:ss` 的时间戳格式一致 | |
+| sharding-suffix-pattern | String | 分片数据源或真实表的后缀格式,必须遵循 Java DateTimeFormatter 的格式,必须和 `datetime-interval-unit` 保持一致。例如:yyyyMM | |
+| datetime-interval-unit | String | 分片键时间间隔单位,必须遵循 Java ChronoUnit 的枚举值。例如:MONTHS | |
+| datetime-interval-amount | int | 分片键时间间隔,超过该时间间隔将进入下一分片 | |
+
### 复合分片算法
#### 复合行表达式分片算法
diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.en.md b/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.en.md
index ffb14ded913..df6bf478f29 100644
--- a/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.en.md
+++ b/docs/document/content/user-manual/common-config/builtin-algorithm/sharding.en.md
@@ -23,6 +23,20 @@ Attributes:
| -------------- | ---------- | -------------- |
| sharding-count | int | Sharding count |
+#### Modulo sharding algorithm provided by CosId
+
+Modulo sharding algorithm implemented by the tool class based on `me.ahoo.cosid:cosid-core`.
+See the discussion at https://github.com/apache/shardingsphere/issues/14047 .
+
+Type: COSID_MOD
+
+Attributes:
+
+| *Name* | *DataType* | *Description* |
+|-------------------| -------- |---------------------------------------------------|
+| mod | int | Sharding count |
+| logic-name-prefix | String | Prefix pattern of sharding data sources or tables |
+
#### Hash Modulo Sharding Algorithm
Type: HASH_MOD
@@ -97,14 +111,55 @@ Type: INTERVAL
Attributes:
-| *Name* | *DataType* | *Description* | *Default Value* |
-| ---------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --------------- |
-| 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 | - |
-| datetime-lower | String | Datetime sharding lower boundary, pattern is defined `datetime-pattern` | - |
-| datetime-upper (?) | String | Datetime sharding upper boundary, pattern is defined `datetime-pattern` | Now |
-| 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 | - |
-| datetime-interval-amount (?) | int | Interval of sharding value | 1 |
-| datetime-interval-unit (?) | String | Unit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS | DAYS |
+| *Name* | *DataType* | *Description* | *Default Value* |
+| ---------------------------- | ---------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --------------- |
+| 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 | - |
+| datetime-lower | String | Datetime sharding lower boundary, pattern is defined `datetime-pattern` | - |
+| datetime-upper (?) | String | Datetime sharding upper boundary, pattern is defined `datetime-pattern` | Now |
+| 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 | - |
+| datetime-interval-amount (?) | int | Interval of sharding value, after which the next shard will be entered | 1 |
+| datetime-interval-unit (?) | String | Unit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS | DAYS |
+
+#### Fixed interval sharding algorithm provided by CosId
+
+A fixed time range sharding algorithm implemented by the tool class based on `me.ahoo.cosid:cosid-core`.
+When the sharding key is a JSR-310 containing class or a time-related class, it will be converted to `java.time.LocalDateTime` before the next sharding.
+See the discussion at https://github.com/apache/shardingsphere/issues/14047.
+
+Type:COSID_INTERVAL
+
+Attributes:
+
+| *Name* | *DataType* | *Description* | *Default Value* |
+|--------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------- |
+| zone-id | String | Time zone, which must follow the contained value of `java.time.ZoneId`. For example: Asia/Shanghai | |
+| logic-name-prefix | String | Prefix pattern of sharding data sources or tables | |
+| datetime-lower | String | Datetime sharding lower boundary, pattern is consistent with the timestamp format of `yyyy-MM-dd HH:mm:ss` | |
+| datetime-upper | String | Datetime sharding upper boundary, pattern is consistent with the timestamp format of `yyyy-MM-dd HH:mm:ss` | |
+| 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 | |
+| datetime-interval-unit | String | Unit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS | |
+| datetime-interval-amount | int | Interval of sharding value, after which the next shard will be entered |
+
+#### Snowflake key-based fixed interval sharding algorithm provided by CosId
+
+Snowflake ID sharding algorithm with fixed time range implemented by tool class based on `me.ahoo.cosid:cosid-core`.
+When the sharding key is a JSR-310 containing class or a time-related class, it will be converted to `java.time.LocalDateTime` before the next sharding.
+See the discussion at https://github.com/apache/shardingsphere/issues/14047.
+
+Type:COSID_INTERVAL_SNOWFLAKE
+
+Attributes:
+
+| *Name* | *DataType* | *Description* | *Default Value* |
+|--------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------- |
+| zone-id | String | Time zone, which must follow the contained value of `java.time.ZoneId`. For example: Asia/Shanghai | |
+| logic-name-prefix | String | Prefix pattern of sharding data sources or tables | |
+| datetime-lower | String | Datetime sharding lower boundary, pattern is consistent with the timestamp format of `yyyy-MM-dd HH:mm:ss` | |
+| datetime-upper | String | Datetime sharding upper boundary, pattern is consistent with the timestamp format of `yyyy-MM-dd HH:mm:ss` | |
+| 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 | |
+| datetime-interval-unit | String | Unit of sharding value interval, must can be transformed to Java ChronoUnit's Enum value. For example: MONTHS | |
+| datetime-interval-amount | int | Interval of sharding value, after which the next shard will be entered |
+
### Complex Sharding Algorithm