This is an automated email from the ASF dual-hosted git repository.

panjuan 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 a850f5d  Update default shadow algorithm docs. (#13257)
a850f5d is described below

commit a850f5d3e2d46a613379c47d63ffe621604c4db5
Author: gin <[email protected]>
AuthorDate: Mon Oct 25 16:45:25 2021 +0800

    Update default shadow algorithm docs. (#13257)
---
 .../document/content/features/shadow/concept.cn.md |   6 +++
 .../document/content/features/shadow/concept.en.md |   6 +++
 .../document/content/reference/shadow/_index.cn.md |  52 +++++++++++++++++++++
 .../document/content/reference/shadow/_index.en.md |   1 +
 .../configuration/java-api/shadow.cn.md            |   1 +
 .../configuration/java-api/shadow.en.md            |   1 +
 .../configuration/spring-boot-starter/shadow.cn.md |   2 +
 .../configuration/spring-boot-starter/shadow.en.md |   2 +
 .../configuration/spring-namespace/shadow.cn.md    |   6 +++
 .../configuration/spring-namespace/shadow.en.md    |   6 +++
 .../configuration/yaml/shadow.cn.md                |   1 +
 .../configuration/yaml/shadow.en.md                |   1 +
 docs/document/static/img/shadow/rule_cn.png        | Bin 254987 -> 307653 bytes
 docs/document/static/img/shadow/rule_en.png        | Bin 220352 -> 271263 bytes
 14 files changed, 85 insertions(+)

diff --git a/docs/document/content/features/shadow/concept.cn.md 
b/docs/document/content/features/shadow/concept.cn.md
index 84bc5c9..45ee375 100644
--- a/docs/document/content/features/shadow/concept.cn.md
+++ b/docs/document/content/features/shadow/concept.cn.md
@@ -39,3 +39,9 @@ weight = 1
 优点:用户可以不确定链路上执行SQL细节,只要知道那个SQL执行即可。
 
 不足:用户需要改代码或者SQL
+
+## 默认影子算法
+
+默认影子算法,选配项。对于没有配置影子算法表的默认匹配算法。
+
+**注意**:默认影子算法仅支持注解影子算法。
diff --git a/docs/document/content/features/shadow/concept.en.md 
b/docs/document/content/features/shadow/concept.en.md
index 1692e23..2789d83 100644
--- a/docs/document/content/features/shadow/concept.en.md
+++ b/docs/document/content/features/shadow/concept.en.md
@@ -36,3 +36,9 @@ It is suitable for scenarios where the value of a field 
involved in the executed
 - Note shadow algorithm
 
 It is suitable for scenarios where the field values involved in executing SQL 
cannot meet certain matching conditions in the test.
+
+## Default Shadow Algorithm
+
+Default shadow algorithm, optional item. For the default matching algorithm 
that is not configured with the shadow algorithm table.
+
+**Note**: The default shadow algorithm only supports note shadow algorithm.
diff --git a/docs/document/content/reference/shadow/_index.cn.md 
b/docs/document/content/reference/shadow/_index.cn.md
index 14c9d83..2308a7e 100644
--- a/docs/document/content/reference/shadow/_index.cn.md
+++ b/docs/document/content/reference/shadow/_index.cn.md
@@ -24,6 +24,8 @@ Apache ShardingSphere 通过解析 SQL,对传入的 SQL 进行影子判定,
 
 **影子算法**:SQL 路由影子算法。
 
+**默认影子算法**:默认影子算法,选配项。对于没有配置影子算法表的默认匹配算法。
+
 ## 路由过程
 
 以 INSERT 语句为例,在写入数据时,Apache ShardingSphere 会对 SQL 
进行解析,再根据配置文件中的规则,构造一条路由链。在当前版本的功能中,
@@ -177,3 +179,53 @@ shadow-algorithms:
       shadow: true
       foo: bar
 ```
+
+4. 使用默认影子算法
+
+假设对 `t_order` 表压测使用列影子算法,其他相关其他表都需要使用注解影子算法。即,
+
+```sql
+INSERT INTO t_order (order_id, user_id, ...) VALUES (xxx..., 0, ...);
+
+INSERT INTO t_order_item (order_item_id, order_id, ...) VALUES (xxx..., 
xxx..., ...) /*shadow:true,foo:bar,...*/;
+
+SELECT * FROM t_order_item WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+
+SELECT * FROM t_order_xxx WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+```
+都会执行到影子库。
+
+配置如下(YAML 格式展示):
+
+```yaml
+enable: true
+  data-sources:
+    shadow-data-source:
+      source-data-source-name: ds
+      shadow-data-source-name: ds-shadow
+tables:
+  t_order:
+    data-source-names: shadow-data-source
+    shadow-algorithm-names:
+      - simple-note-algorithm
+      - user-id-match-algorithm
+default-shadow-algorithm-name: simple-note-algorithm
+shadow-algorithms:
+  simple-note-algorithm:
+    type: SIMPLE_NOTE
+    props:
+      shadow: true
+      foo: bar
+  user-id-match-algorithm:
+    type: COLUMN_REGEX_MATCH
+    props:
+      operation: insert
+      column: user_id
+      regex: "[0]"
+      
+props:
+  sql-comment-parse-enabled: true
+```
+我们只需要配置默认影子算法 `default-shadow-algorithm-name`。 除了影子表 `t_order` 
其它相关表都会进行默认影子算法的判定。
+
+**注意**:默认影子算法仅支持注解影子算法。
diff --git a/docs/document/content/reference/shadow/_index.en.md 
b/docs/document/content/reference/shadow/_index.en.md
index b480aa5..2601ded 100644
--- a/docs/document/content/reference/shadow/_index.en.md
+++ b/docs/document/content/reference/shadow/_index.en.md
@@ -26,6 +26,7 @@ The shadow table needs to specify the corresponding shadow 
library mapping and s
 
 **shadow-algorithms**:SQL routing shadow algorithm.
 
+**default-shadow-algorithm-name**:Default shadow algorithm, optional item. For 
the default matching algorithm that is not configured with the shadow algorithm 
table.
 
 ## Routing Process
 
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.cn.md
index 27ddea6..c1f56c9 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.cn.md
@@ -14,6 +14,7 @@ weight = 4
 | enable | boolean    | 影子库功能开关。可选值:true/false |false|
 | dataSources | Map\<String, ShadowDataSourceConfiguration\> | 影子数据源映射名称和配置 |无|
 | tables | Map\<String, ShadowTableConfiguration\> | 影子表名称和配置 |无|
+| defaultShadowAlgorithmName | String | 默认影子算法名称 | 选配项 |
 | shadowAlgorithms | Map\<String, ShardingSphereAlgorithmConfiguration\> | 
影子算法名称和配置 |无|
 
 ## 影子数据源配置
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.en.md
index 3226987..7d7bef7 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/java-api/shadow.en.md
@@ -14,6 +14,7 @@ Attributes:
 | enable | boolean    | Shadow DB function switch. Optional values: true/false 
|false|
 | dataSources | Map\<String, ShadowDataSourceConfiguration\> | Shadow data 
source mapping name and configuration | None |
 | tables | Map\<String, ShadowTableConfiguration\> | Shadow table name and 
configuration | None |
+| defaultShadowAlgorithmName | String | default shadow algorithm name | Option 
item |
 | shadowAlgorithms | Map\<String, ShardingSphereAlgorithmConfiguration\> | 
Shadow algorithm name and configuration | None |
 
 ## Shadow Data Source Configuration
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.cn.md
index ea469f5..c9ea917 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.cn.md
@@ -16,6 +16,8 @@ 
spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.shadow-data-s
 spring.shardingsphere.rules.shadow.tables.<table-name>.data-source-names= # 
影子表关联影子数据源名称列表(多个值用","隔开)
 spring.shardingsphere.rules.shadow.tables.<table-name>.shadow-algorithm-names= 
# 影子表关联影子算法名称列表(多个值用","隔开)
 
+spring.shardingsphere.rules.shadow.defaultShadowAlgorithmName= # 默认影子算法名称,选配项。
+
 
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.type=
 # 影子算法类型
 
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.props.xxx=
 # 影子算法属性配置
 ```
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.en.md
index 363836e..5f0342c 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-boot-starter/shadow.en.md
@@ -16,6 +16,8 @@ 
spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.shadow-data-s
 spring.shardingsphere.rules.shadow.tables.<table-name>.data-source-names= # 
Shadow table location shadow data source names (multiple values are separated 
by ",")
 spring.shardingsphere.rules.shadow.tables.<table-name>.shadow-algorithm-names= 
# Shadow table location shadow algorithm names (multiple values are separated 
by ",")
 
+spring.shardingsphere.rules.shadow.defaultShadowAlgorithmName= # default 
shadow algorithm name,optional item.
+
 
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.type=
 # Shadow algorithm type
 
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.props.xxx=
 # Shadow algorithm property configuration
 ```
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.cn.md
index de3d1b7..d852f15 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.cn.md
@@ -14,6 +14,7 @@ weight = 4
 | id    | 属性    | Spring Bean Id |
 | enable | 属性   | Shadow功能开关。 可选值:true/false,默认为false |
 | data-source(?)  | 标签  | 影子数据源配置 |
+| default-shadow-algorithm-name(?)  | 标签  | 默认影子算法配置 |
 | shadow-table(?) | 标签  | 影子表配置 |
 
 \<shadow:data-source />
@@ -24,6 +25,11 @@ weight = 4
 | source-data-source-name | 属性 | 生产数据源名称 |
 | shadow-data-source-name | 属性 | 影子数据源名称 |
 
+\<shadow:default-shadow-algorithm-name />
+| *名称* | *类型*  | *说明* |
+| ----- | ------ | ------ |
+| name | 属性 | 默认影子算法名称 |
+
 \<shadow:shadow-table />
 
 | *名称* | *类型*  | *说明* |
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.en.md
index d5287c9..b364744 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/spring-namespace/shadow.en.md
@@ -14,6 +14,7 @@ Namespace: 
[http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow
 | id     | Attribute | Spring Bean Id |
 | enable | Attribute | Shadow function switch. Optional values: true/false, 
the default is false |
 | data-source(?)  | Tag | Shadow data source configuration |
+| default-shadow-algorithm-name(?)  | Tag  | Default shadow algorithm 
configuration |
 | shadow-table(?) | Tag | Shadow table configuration |
 
 \<shadow:data-source />
@@ -24,6 +25,11 @@ Namespace: 
[http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow
 | source-data-source-name | Attribute | Production data source name |
 | shadow-data-source-name | Attribute | Shadow data source name |
 
+\<shadow:default-shadow-algorithm-name />
+| *Name* | *Type*  | *Description* |
+| ----- | ------ | ------ |
+| name | Attribute | Default shadow algorithm name |
+
 \<shadow:shadow-table />
 
 | *Name* | *Type*  | *Description* |
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.cn.md
index 513d784..e1c6bdc 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.cn.md
@@ -21,6 +21,7 @@ rules:
         - <shadow-data-source> 
       shadowAlgorithmNames: # 影子表关联影子算法名称列表
         - <shadow-algorithm-name>
+  defaultShadowAlgorithmName: # 默认影子算法名称
   shadowAlgorithms:
     <shadow-algorithm-name> (+): # 影子算法名称
       type: # 影子算法类型
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.en.md
index 6482d92..5102dad 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/configuration/yaml/shadow.en.md
@@ -21,6 +21,7 @@ rules:
           - <shadow-data-source> 
         shadowAlgorithmNames: # Shadow table location shadow algorithm names
           - <shadow-algorithm-name>
+    defaultShadowAlgorithmName: # Default shadow algorithm name
     shadowAlgorithms:
       <shadow-algorithm-name> (+): # Shadow algorithm name
         type: # Shadow algorithm type
diff --git a/docs/document/static/img/shadow/rule_cn.png 
b/docs/document/static/img/shadow/rule_cn.png
index 70edf0c..b3f527c 100644
Binary files a/docs/document/static/img/shadow/rule_cn.png and 
b/docs/document/static/img/shadow/rule_cn.png differ
diff --git a/docs/document/static/img/shadow/rule_en.png 
b/docs/document/static/img/shadow/rule_en.png
index 941e67a..4eea09c 100644
Binary files a/docs/document/static/img/shadow/rule_en.png and 
b/docs/document/static/img/shadow/rule_en.png differ

Reply via email to