You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2020/12/17 02:54:56 UTC
[shardingsphere] branch master updated: Issue#7942 (#8657)
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 0e7fdad Issue#7942 (#8657)
0e7fdad is described below
commit 0e7fdad42d88d7703b859bdba5c2b11ff3f64f7b
Author: huanghao495430759 <34...@users.noreply.github.com>
AuthorDate: Thu Dec 17 10:54:40 2020 +0800
Issue#7942 (#8657)
* Add test case for PostgreSQLCommand #8439
* Add test case for UpdateResponseHeader #8440
* Add test case for PostgreSQLCommand #8439
* Add test case for UpdateResponseHeader #8440
* revert commit
* fix issue#7942:Configuration error in test-engine/performance-test and test-engine/rewrite-test-engine page.
Co-authored-by: huanghao-jk <hu...@360jinrong.net>
---
.../features/test-engine/performance-test.cn.md | 136 ++++++++++++++------
.../features/test-engine/performance-test.en.md | 138 ++++++++++++++-------
.../features/test-engine/rewrite-test-engine.cn.md | 27 +++-
.../features/test-engine/rewrite-test-engine.en.md | 27 +++-
4 files changed, 233 insertions(+), 95 deletions(-)
diff --git a/docs/document/content/features/test-engine/performance-test.cn.md b/docs/document/content/features/test-engine/performance-test.cn.md
index b565596..b2a3e35 100644
--- a/docs/document/content/features/test-engine/performance-test.cn.md
+++ b/docs/document/content/features/test-engine/performance-test.cn.md
@@ -89,23 +89,38 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-shardingRule:
- tables:
- tbl:
- actualDataNodes: ds_${0..3}.tbl${0..1023}
- tableStrategy:
- inline:
- shardingColumn: k
- algorithmExpression: tbl${k % 1024}
- keyGenerateStrategy:
- type: SNOWFLAKE
- column: id
- defaultDatabaseStrategy:
- inline:
- shardingColumn: id
- algorithmExpression: ds_${id % 4}
- defaultTableStrategy:
- none:
+rules:
+- !SHARDING
+ tables:
+ tbl:
+ actualDataNodes: ds_${0..3}.tbl${0..1023}
+ tableStrategy:
+ standard:
+ shardingColumn: k
+ shardingAlgorithmName: tbl_table_inline
+ keyGenerateStrategy:
+ column: id
+ keyGeneratorName: snowflake
+ defaultDatabaseStrategy:
+ standard:
+ shardingColumn: id
+ shardingAlgorithmName: default_db_inline
+ defaultTableStrategy:
+ none:
+ shardingAlgorithms:
+ tbl_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: tbl${k % 1024}
+ default_db_inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_${id % 4}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
```
#### 主从配置
@@ -130,11 +145,14 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-replicaQueryRule:
- name: pr_ds
- primaryDataSourceName: primary_ds
- replicaDataSourceNames:
- - replica_ds_0
+rules:
+- !REPLICA_QUERY
+ dataSources:
+ pr_ds:
+ name: pr_ds
+ primaryDataSourceName: primary_ds
+ replicaDataSourceNames:
+ - replica_ds_0
```
#### 主从+加密+分库分表配置
@@ -207,48 +225,67 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-shardingRule:
+rules:
+- !SHARDING
tables:
tbl:
actualDataNodes: pr_ds_${0..3}.tbl${0..1023}
databaseStrategy:
- inline:
+ standard:
shardingColumn: id
- algorithmExpression: pr_ds_${id % 4}
+ shardingAlgorithmName: tbl_database_inline
tableStrategy:
- inline:
+ standard:
shardingColumn: k
- algorithmExpression: tbl${k % 1024}
+ shardingAlgorithmName: tbl_table_inline
keyGenerateStrategy:
- type: SNOWFLAKE
column: id
+ keyGeneratorName: snowflake
bindingTables:
- tbl
defaultDataSourceName: primary_ds_1
defaultTableStrategy:
none:
- replicaQueryRules:
+ shardingAlgorithms:
+ tbl_database_inline:
+ type: INLINE
+ props:
+ algorithm-expression: pr_ds_${id % 4}
+ tbl_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: tbl${k % 1024}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
+- !REPLICA_QUERY
+ dataSources:
pr_ds_0:
primaryDataSourceName: primary_ds_0
replicaDataSourceNames:
- replica_ds_0
- loadBalanceAlgorithmType: ROUND_ROBIN
+ loadBalancerName: round_robin
pr_ds_1:
primaryDataSourceName: primary_ds_1
replicaDataSourceNames:
- replica_ds_1
- loadBalanceAlgorithmType: ROUND_ROBIN
+ loadBalancerName: round_robin
pr_ds_2:
primaryDataSourceName: primary_ds_2
replicaDataSourceNames:
- replica_ds_2
- loadBalanceAlgorithmType: ROUND_ROBIN
+ loadBalancerName: round_robin
pr_ds_3:
primaryDataSourceName: primary_ds_3
replicaDataSourceNames:
- replica_ds_3
- loadBalanceAlgorithmType: ROUND_ROBIN
-encryptRule:
+ loadBalancerName: round_robin
+ loadBalancers:
+ round_robin:
+ type: ROUND_ROBIN
+- !ENCRYPT:
encryptors:
aes_encryptor:
type: AES
@@ -266,6 +303,8 @@ encryptRule:
pad:
cipherColumn: pad_cipher
encryptorName: md5_encryptor
+props:
+ query-with-cipher-column: true
```
#### 全路由
@@ -306,23 +345,38 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-shardingRule:
+rules:
+- !SHARDING
tables:
tbl:
actualDataNodes: ds_${0..3}.tbl1
tableStrategy:
- inline:
+ standard:
shardingColumn: k
- algorithmExpression: tbl1
+ shardingAlgorithmName: tbl_table_inline
keyGenerateStrategy:
- type: SNOWFLAKE
- column: id
+ column: id
+ keyGeneratorName: snowflake
defaultDatabaseStrategy:
- inline:
+ standard:
shardingColumn: id
- algorithmExpression: ds_${id % 4}
+ shardingAlgorithmName: default_database_inline
defaultTableStrategy:
none:
+ shardingAlgorithms:
+ default_database_inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_${id % 4}
+ tbl_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: tbl1
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
```
## 测试结果验证
diff --git a/docs/document/content/features/test-engine/performance-test.en.md b/docs/document/content/features/test-engine/performance-test.en.md
index 34f1d27..6c36667 100644
--- a/docs/document/content/features/test-engine/performance-test.en.md
+++ b/docs/document/content/features/test-engine/performance-test.en.md
@@ -90,23 +90,38 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-shardingRule:
- tables:
- tbl:
- actualDataNodes: ds_${0..3}.tbl${0..1023}
- tableStrategy:
- inline:
- shardingColumn: k
- algorithmExpression: tbl${k % 1024}
- keyGenerateStrategy:
- type: SNOWFLAKE
- column: id
- defaultDatabaseStrategy:
- inline:
- shardingColumn: id
- algorithmExpression: ds_${id % 4}
- defaultTableStrategy:
- none:
+rules:
+- !SHARDING
+ tables:
+ tbl:
+ actualDataNodes: ds_${0..3}.tbl${0..1023}
+ tableStrategy:
+ standard:
+ shardingColumn: k
+ shardingAlgorithmName: tbl_table_inline
+ keyGenerateStrategy:
+ column: id
+ keyGeneratorName: snowflake
+ defaultDatabaseStrategy:
+ inline:
+ shardingColumn: id
+ shardingAlgorithmName: default_db_inline
+ defaultTableStrategy:
+ none:
+ shardingAlgorithms:
+ tbl_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: tbl${k % 1024}
+ default_db_inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_${id % 4}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
```
#### Replica Query Configuration
@@ -131,11 +146,14 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-replicaQueryRule:
- name: pr_ds
- primaryDataSourceName: primary_ds
- replicaDataSourceNames:
- - replica_ds_0
+rules:
+- !REPLICA_QUERY
+ dataSources:
+ pr_ds:
+ name: pr_ds
+ primaryDataSourceName: primary_ds
+ replicaDataSourceNames:
+ - replica_ds_0
```
#### Replica Query & Encrypt & Sharding Configuration
@@ -208,48 +226,67 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-shardingRule:
+rules:
+- !SHARDING
tables:
tbl:
actualDataNodes: pr_ds_${0..3}.tbl${0..1023}
databaseStrategy:
- inline:
+ standard:
shardingColumn: id
- algorithmExpression: pr_ds_${id % 4}
+ shardingAlgorithmName: tbl_database_inline
tableStrategy:
- inline:
+ standard:
shardingColumn: k
- algorithmExpression: tbl${k % 1024}
+ shardingAlgorithmName: tbl_table_inline
keyGenerateStrategy:
- type: SNOWFLAKE
column: id
+ keyGeneratorName: snowflake
bindingTables:
- tbl
defaultDataSourceName: primary_ds_1
defaultTableStrategy:
none:
- replicaQueryRules:
+ shardingAlgorithms:
+ tbl_database_inline:
+ type: INLINE
+ props:
+ algorithm-expression: pr_ds_${id % 4}
+ tbl_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: tbl${k % 1024}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
+- !REPLICA_QUERY
+ dataSources:
pr_ds_0:
primaryDataSourceName: primary_ds_0
replicaDataSourceNames:
- replica_ds_0
- loadBalanceAlgorithmType: ROUND_ROBIN
+ loadBalancerName: round_robin
pr_ds_1:
primaryDataSourceName: primary_ds_1
replicaDataSourceNames:
- replica_ds_1
- loadBalanceAlgorithmType: ROUND_ROBIN
+ loadBalancerName: round_robin
pr_ds_2:
primaryDataSourceName: primary_ds_2
replicaDataSourceNames:
- replica_ds_2
- loadBalanceAlgorithmType: ROUND_ROBIN
+ loadBalancerName: round_robin
pr_ds_3:
primaryDataSourceName: primary_ds_3
replicaDataSourceNames:
- replica_ds_3
- loadBalanceAlgorithmType: ROUND_ROBIN
-encryptRule:
+ loadBalancerName: round_robin
+ loadBalancers:
+ round_robin:
+ type: ROUND_ROBIN
+- !ENCRYPT:
encryptors:
aes_encryptor:
type: AES
@@ -266,7 +303,9 @@ encryptRule:
encryptorName: aes_encryptor
pad:
cipherColumn: pad_cipher
- encryptorName: md5_encryptor
+ encryptorName: md5_encryptor
+props:
+ query-with-cipher-column: true
```
#### Full Route Configuration
@@ -307,23 +346,38 @@ dataSources:
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 200
-shardingRule:
+rules:
+- !SHARDING
tables:
tbl:
actualDataNodes: ds_${0..3}.tbl1
tableStrategy:
- inline:
+ standard:
shardingColumn: k
- algorithmExpression: tbl1
+ shardingAlgorithmName: tbl_table_inline
keyGenerateStrategy:
- type: SNOWFLAKE
- column: id
+ column: id
+ keyGeneratorName: snowflake
defaultDatabaseStrategy:
- inline:
+ standard:
shardingColumn: id
- algorithmExpression: ds_${id % 4}
+ shardingAlgorithmName: default_database_inline
defaultTableStrategy:
none:
+ shardingAlgorithms:
+ default_database_inline:
+ type: INLINE
+ props:
+ algorithm-expression: ds_${id % 4}
+ tbl_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: tbl1
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
```
## Test Result Verification
diff --git a/docs/document/content/features/test-engine/rewrite-test-engine.cn.md b/docs/document/content/features/test-engine/rewrite-test-engine.cn.md
index 473395d..705c51e 100644
--- a/docs/document/content/features/test-engine/rewrite-test-engine.cn.md
+++ b/docs/document/content/features/test-engine/rewrite-test-engine.cn.md
@@ -29,25 +29,40 @@ dataSources:
password:
## sharding 规则
-shardingRule:
+rules:
+- !SHARDING
tables:
t_account:
actualDataNodes: db.t_account_${0..1}
tableStrategy:
- inline:
+ standard:
shardingColumn: account_id
- algorithmExpression: t_account_${account_id % 2}
+ shardingAlgorithmName: account_table_inline
keyGenerateStrategy:
- type: TEST
column: account_id
+ keyGeneratorName: snowflake
t_account_detail:
actualDataNodes: db.t_account_detail_${0..1}
tableStrategy:
- inline:
+ standard:
shardingColumn: order_id
- algorithmExpression: t_account_detail_${account_id % 2}
+ shardingAlgorithmName: account_detail_table_inline
bindingTables:
- t_account, t_account_detail
+ shardingAlgorithms:
+ account_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_account_${account_id % 2}
+ account_detail_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_account_detail_${account_id % 2}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
```
验证数据存放在 `test\resources` 路径中测试类型下对应的 xml 文件中。验证数据中, `yaml-rule` 指定了环境以及 rule 的配置文件,`input` 指定了待测试的 SQL 以及参数,`output` 指定了期待的 SQL 以及参数。
diff --git a/docs/document/content/features/test-engine/rewrite-test-engine.en.md b/docs/document/content/features/test-engine/rewrite-test-engine.en.md
index 723729d..be96a5b 100644
--- a/docs/document/content/features/test-engine/rewrite-test-engine.en.md
+++ b/docs/document/content/features/test-engine/rewrite-test-engine.en.md
@@ -29,25 +29,40 @@ dataSources:
password:
## sharding Rules
-shardingRule:
+rules:
+- !SHARDING
tables:
t_account:
actualDataNodes: db.t_account_${0..1}
tableStrategy:
- inline:
+ standard:
shardingColumn: account_id
- algorithmExpression: t_account_${account_id % 2}
+ shardingAlgorithmName: account_table_inline
keyGenerateStrategy:
- type: TEST
column: account_id
+ keyGeneratorName: snowflake
t_account_detail:
actualDataNodes: db.t_account_detail_${0..1}
tableStrategy:
- inline:
+ standard:
shardingColumn: order_id
- algorithmExpression: t_account_detail_${account_id % 2}
+ shardingAlgorithmName: account_detail_table_inline
bindingTables:
- t_account, t_account_detail
+ shardingAlgorithms:
+ account_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_account_${account_id % 2}
+ account_detail_table_inline:
+ type: INLINE
+ props:
+ algorithm-expression: t_account_detail_${account_id % 2}
+ keyGenerators:
+ snowflake:
+ type: SNOWFLAKE
+ props:
+ worker-id: 123
```
Assert data are in the xml under test type in `test\resources`. In the xml file, `yaml-rule` means the environment configuration file path, `input` contains the target SQL and parameters, `output` contains the expected SQL and parameters.