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 8b38f04 Update docs for shadow. (#14255)
8b38f04 is described below
commit 8b38f04bcd3d71fef339102f5234db940cbfe59f
Author: gin <[email protected]>
AuthorDate: Thu Dec 23 12:28:14 2021 +0800
Update docs for shadow. (#14255)
---
docs/document/content/dev-manual/shadow.cn.md | 2 +-
docs/document/content/dev-manual/shadow.en.md | 2 +-
.../content/features/shadow/use-norms.cn.md | 4 +-
.../content/features/shadow/use-norms.en.md | 4 +-
.../document/content/reference/shadow/_index.cn.md | 46 ++++++++++-----------
.../document/content/reference/shadow/_index.en.md | 47 +++++++++++-----------
.../builtin-algorithm/shadow.cn.md | 4 +-
.../builtin-algorithm/shadow.en.md | 4 +-
8 files changed, 55 insertions(+), 58 deletions(-)
diff --git a/docs/document/content/dev-manual/shadow.cn.md
b/docs/document/content/dev-manual/shadow.cn.md
index 89309d1..fd2bb59 100644
--- a/docs/document/content/dev-manual/shadow.cn.md
+++ b/docs/document/content/dev-manual/shadow.cn.md
@@ -15,4 +15,4 @@ chapter = true
|-------------------------------- |----------------------- |
| ColumnValueMatchShadowAlgorithm | 基于字段值匹配影子算法 |
| ColumnRegexMatchShadowAlgorithm | 基于字段值正则匹配影子算法 |
-| SimpleSQLNoteShadowAlgorithm | 基于SQL注解简单匹配影子算法 |
+| SimpleHintShadowAlgorithm | 基于 Hint 简单匹配影子算法 |
diff --git a/docs/document/content/dev-manual/shadow.en.md
b/docs/document/content/dev-manual/shadow.en.md
index 902abd4..fab0f55 100644
--- a/docs/document/content/dev-manual/shadow.en.md
+++ b/docs/document/content/dev-manual/shadow.en.md
@@ -15,4 +15,4 @@ chapter = true
| ------------------------------- | ----------------------------------- |
| ColumnValueMatchShadowAlgorithm | Column value match shadow algorithm |
| ColumnRegexMatchShadowAlgorithm | Column regex match shadow algorithm |
-| SimpleSQLNoteShadowAlgorithm | Simple SQL note shadow algorithm |
+| SimpleHintShadowAlgorithm | Simple hint shadow algorithm |
diff --git a/docs/document/content/features/shadow/use-norms.cn.md
b/docs/document/content/features/shadow/use-norms.cn.md
index 9347c1a..bf2b2cc 100644
--- a/docs/document/content/features/shadow/use-norms.cn.md
+++ b/docs/document/content/features/shadow/use-norms.cn.md
@@ -5,12 +5,12 @@ weight = 2
## 支持项
-* 基于标记的影子算法支持全部 SQL;
+* 基于 Hint 的影子算法支持全部 SQL;
* 基于列的影子算法仅支持部分 SQL。
## 不支持项
-### 基于标记的影子算法
+### 基于 Hint 的影子算法
* 无
diff --git a/docs/document/content/features/shadow/use-norms.en.md
b/docs/document/content/features/shadow/use-norms.en.md
index ac716bd..0b3457a 100644
--- a/docs/document/content/features/shadow/use-norms.en.md
+++ b/docs/document/content/features/shadow/use-norms.en.md
@@ -5,12 +5,12 @@ weight = 2
## Supported
-* Note based shadow algorithm support all SQL;
+* Hint based shadow algorithm support all SQL;
* Column based shadow algorithm support part of SQL.
## Unsupported
-### Note based shadow algorithm
+### Hint based shadow algorithm
* None
diff --git a/docs/document/content/reference/shadow/_index.cn.md
b/docs/document/content/reference/shadow/_index.cn.md
index 111c9ee..731216f 100644
--- a/docs/document/content/reference/shadow/_index.cn.md
+++ b/docs/document/content/reference/shadow/_index.cn.md
@@ -44,8 +44,8 @@ Apache ShardingSphere 通过解析 SQL,对传入的 SQL 进行影子判定,
仅支持注解影子算法。在压测场景下,DDL 语句一般不需要测试。主要在初始化或者修改影子库中影子表时使用。
-影子判定会首先判断执行 SQL 是否包含注解。如果包含注解,影子规则中配置的注解影子算法依次判定。有任何一个判定成功。SQL 语句路由到影子库。
-执行 SQL 不包含注解或者注解影子算法判定不成功,SQL 语句路由到生产库。
+影子判定会首先判断执行 SQL 是否包含注解。如果包含注解,影子规则中配置的 HINT 影子算法依次判定。有任何一个判定成功。SQL 语句路由到影子库。
+执行 SQL 不包含注解或者 HINT 影子算法判定不成功,SQL 语句路由到生产库。
## 影子算法
@@ -77,7 +77,6 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
user-id-value-match-algorithm:
type: VALUE_MATCH
@@ -97,10 +96,10 @@ props:
* 创建影子库 `ds_shadow`。
-* 创建影子表,表结构与生产环境必须一致。假设在影子库创建 `t_order` 表。创建表语句需要添加 SQL 注释
`/*shadow:true,foo:bar,...*/`。即:
+* 创建影子表,表结构与生产环境必须一致。假设在影子库创建 `t_order` 表。创建表语句需要添加 SQL 注释 `/*foo:bar,...*/`。即:
```sql
-CREATE TABLE t_order (order_id INT(11) primary key, user_id int(11) not null,
...) /*shadow:true,foo:bar,...*/
+CREATE TABLE t_order (order_id INT(11) primary key, user_id int(11) not null,
...) /*foo:bar,...*/
```
执行到影子库。
@@ -131,12 +130,12 @@ shadow-algorithms:
**注意**:影子表使用列影子算法时,相同类型操作(INSERT, UPDATE, DELETE, SELECT)目前仅支持单个字段。
-2. 使用HINT影子算法
+2. 使用 Hint 影子算法
-假设 `t_order` 表中不包含可以对值进行匹配的列。添加注解 `/*shadow:true,foo:bar,...*/` 到执行 SQL 中,即:
+假设 `t_order` 表中不包含可以对值进行匹配的列。添加注解 `/*foo:bar,...*/` 到执行 SQL 中,即:
```sql
-SELECT * FROM t_order WHERE order_id = xxx /*shadow:true,foo:bar,...*/
+SELECT * FROM t_order WHERE order_id = xxx /*foo:bar,...*/
```
会执行到影子库,其他数据执行到生产库。
@@ -148,7 +147,6 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
```
@@ -159,7 +157,7 @@ shadow-algorithms:
```sql
INSERT INTO t_order (order_id, user_id, ...) VALUES (xxx..., 0, ...);
-SELECT * FROM t_order WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+SELECT * FROM t_order WHERE order_id = xxx /*foo:bar,...*/;
```
都会执行到影子库,其他数据执行到生产库。
@@ -177,22 +175,21 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
```
4. 使用默认影子算法
-假设对 `t_order` 表压测使用列影子算法,其他相关其他表都需要使用注解影子算法。即,
+假设对 `t_order` 表压测使用列影子算法,其他相关其他表都需要使用 Hint 影子算法。即,
```sql
INSERT INTO t_order (order_id, user_id, ...) VALUES (xxx..., 0, ...);
-INSERT INTO t_xxx_1 (order_item_id, order_id, ...) VALUES (xxx..., xxx...,
...) /*shadow:true,foo:bar,...*/;
+INSERT INTO t_xxx_1 (order_item_id, order_id, ...) VALUES (xxx..., xxx...,
...) /*foo:bar,...*/;
-SELECT * FROM t_xxx_2 WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:bar,...*/;
-SELECT * FROM t_xxx_3 WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+SELECT * FROM t_xxx_3 WHERE order_id = xxx /*foo:bar,...*/;
```
都会执行到影子库,其他数据执行到生产库。
@@ -216,7 +213,6 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
user-id-value-match-algorithm:
type: VALUE_MATCH
@@ -230,38 +226,38 @@ props:
```
**注意**
-默认影子算法仅支持HINT影子算法。
-使用HINT,必须确保配置文件中 `props` 的配置项小于等于 SQL 注释中的配置项,且配置文件的具体配置要和 SQL
注释中写的配置一样,配置文件中配置项越少,匹配条件越宽松
+默认影子算法仅支持 Hint 影子算法。
+使用时必须确保配置文件中 `props` 的配置项小于等于 SQL 注释中的配置项,且配置文件的具体配置要和 SQL
注释中写的配置一样,配置文件中配置项越少,匹配条件越宽松
```yaml
simple-note-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
- user_id: 2
+ foo: bar
+ foo1: bar1
```
如当前 `props` 项中配置了 `2` 条配置,在 SQL 中可以匹配的写法有如下:
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx /*shadow:true,user_id:2*/
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:bar, foo1:bar1*/
```
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx
/*shadow:true,user_id:2,foo:bar,.....*/
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:bar, foo1:bar1, foo2:bar2,
...*/
```
```yaml
simple-note-algorithm:
type: SIMPLE_HINT
props:
- shadow: false
+ foo: bar
```
如当前 props 项中配置了 1 条配置,在sql中可以匹配的写法有如下:
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx /*shadow:false*/
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:foo*/
```
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx
/*shadow:false,user_id:2,foo:bar,.....*/
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:foo, foo1:bar1, ...*/
```
diff --git a/docs/document/content/reference/shadow/_index.en.md
b/docs/document/content/reference/shadow/_index.en.md
index 1a43aa4..e32c0ca 100644
--- a/docs/document/content/reference/shadow/_index.en.md
+++ b/docs/document/content/reference/shadow/_index.en.md
@@ -96,7 +96,6 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
user-id-value-match-algorithm:
type: VALUE_MATCH
@@ -109,7 +108,7 @@ props:
sql-comment-parse-enabled: true
```
-**Note**: If you use the annotation shadow algorithm, the parse SQL comment
configuration item `sql-comment-parse-enabled: true` need to be turned on.
turned off by default.
+**Note**: If you use the Hint shadow algorithm, the parse SQL comment
configuration item `sql-comment-parse-enabled: true` need to be turned on.
turned off by default.
please refer to [Configuration Props](
https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/configuration/props/)
### Shadow DB environment
@@ -117,10 +116,10 @@ please refer to [Configuration Props](
https://shardingsphere.apache.org/documen
* Create the shadow DB `ds_shadow`.
* Create shadow tables, tables structure must be consistent with the
production environment.
- Assume that the `t_order` table created in the shadow DB. Create table
statement need to add SQL note `/*shadow:true,foo:bar,.. .*/`.
+ Assume that the `t_order` table created in the shadow DB. Create table
statement need to add SQL comment `/*foo:bar,.. .*/`.
```sql
-CREATE TABLE t_order (order_id INT(11) primary key, user_id int(11) not null,
...) /*shadow:true,foo:bar,...*/
+CREATE TABLE t_order (order_id INT(11) primary key, user_id int(11) not null,
...) /*foo:bar,...*/
```
Execute to the shadow DB.
@@ -153,10 +152,10 @@ shadow-algorithms:
2. Hint shadow algorithm example
-Assume that the `t_order` table does not contain columns that can matching.
Executed SQL statement need to add SQL note `/*shadow:true,foo:bar,.. .*/`
+Assume that the `t_order` table does not contain columns that can matching.
Executed SQL statement need to add SQL note `/*foo:bar,.. .*/`
```sql
-SELECT * FROM t_order WHERE order_id = xxx /*shadow:true,foo:bar,...*/
+SELECT * FROM t_order WHERE order_id = xxx /*foo:bar,...*/
```
SQL executed to shadow DB, other data executed to production DB.
@@ -167,7 +166,6 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
```
@@ -178,7 +176,7 @@ Assume that the pressure testing of the `t_order` gauge
needs to cover the above
```sql
INSERT INTO t_order (order_id, user_id, ...) VALUES (xxx..., 0, ...);
-SELECT * FROM t_order WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+SELECT * FROM t_order WHERE order_id = xxx /*foo:bar,...*/;
```
Both will be executed to shadow DB, other data executed to production DB.
@@ -196,7 +194,6 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
```
@@ -207,11 +204,11 @@ Assume that the column shadow algorithm used for the
`t_order`, all other shadow
```sql
INSERT INTO t_order (order_id, user_id, ...) VALUES (xxx..., 0, ...);
-INSERT INTO t_xxx_1 (order_item_id, order_id, ...) VALUES (xxx..., xxx...,
...) /*shadow:true,foo:bar,...*/;
+INSERT INTO t_xxx_1 (order_item_id, order_id, ...) VALUES (xxx..., xxx...,
...) /*foo:bar,...*/;
-SELECT * FROM t_xxx_2 WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:bar,...*/;
-SELECT * FROM t_xxx_3 WHERE order_id = xxx /*shadow:true,foo:bar,...*/;
+SELECT * FROM t_xxx_3 WHERE order_id = xxx /*foo:bar,...*/;
```
Both will be executed to shadow DB, other data executed to production DB.
@@ -235,7 +232,6 @@ shadow-algorithms:
simple-hint-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
foo: bar
user-id-value-match-algorithm:
type: VALUE_MATCH
@@ -249,34 +245,39 @@ props:
```
**Note**:
-The default shadow algorithm only supports note shadow algorithm.
-When using HINT, ensure that the configuration items of `props` in the
configuration file are less than or equal to those in the SQL comment, and that
the configuration items in the configuration file are the same as those in the
SQL comment. The fewer the configuration items in the configuration file, the
looser the matching conditions are
+The default shadow algorithm only supports Hint shadow algorithm.
+When using ensure that the configuration items of `props` in the configuration
file are less than or equal to those in the SQL comment, And the specific
configuration of the configuration file
+should same as the configuration written in the SQL comment. The fewer
configuration items in the configuration file, the looser the matching
conditions
```yaml
simple-note-algorithm:
type: SIMPLE_HINT
props:
- shadow: true
- user_id: 2
+ foo: bar
+ foo1: bar1
```
+
For example, the 'props' item have `2` configure, the following syntax can be
used in SQL:
+
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx /*shadow:true,user_id:2*/、
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:bar, foo1:bar1*/
```
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx
/*shadow:true,user_id:2,foo:bar,.....*/
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:bar, foo1:bar1, foo2:bar2,
...*/
```
```yaml
-simple-note-algorithm:
+simple-note-algorithm:
type: SIMPLE_HINT
props:
- shadow: false
+ foo: bar
```
+
For example, the 'props' item have `1` configure, the following syntax can be
used in SQL:
+
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx /*shadow:false*/、
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:foo*/
```
```sql
-SELECT * FROM t_xxx_2 WHERE order_id = xxx
/*shadow:false,user_id:2,foo:bar,.....*/
+SELECT * FROM t_xxx_2 WHERE order_id = xxx /*foo:foo, foo1:bar1, ...*/
```
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
index 054ea91..ed205cf 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
@@ -29,9 +29,9 @@ weight = 6
| operation | String | SQL操作类型(INSERT, UPDATE, DELETE, SELECT) |
| regex | String | 影子列匹配正则表达式 |
-## 注解影子算法
+## Hint 影子算法
-### 简单 SQL 注解匹配影子算法
+### 简单 Hint 匹配影子算法
类型:SIMPLE_HINT
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
index 8934fd2..df7039b 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
@@ -29,9 +29,9 @@ Attributes:
| operation | String | SQL operation type (insert, update, delete,
select) |
| regex | String | Shadow column matching regular expression |
-## Note Shadow Algorithm
+## Hint Shadow Algorithm
-### Simple SQL Note Shadow Algorithm
+### Simple Hint Shadow Algorithm
Type: SIMPLE_HINT