You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/12/27 12:46:10 UTC
[GitHub] [incubator-shardingsphere] haetao opened a new pull request #3824:
Modify the way to identify Rule Configuration in Config Center
haetao opened a new pull request #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824
Fixes #3817 .
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] haetao commented on a change in pull
request #3824: Modify the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
haetao commented on a change in pull request #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824#discussion_r361824668
##########
File path: sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationService.java
##########
@@ -174,7 +174,13 @@ private boolean hasProperties() {
* @return is sharding rule or not
*/
public boolean isShardingRule(final String shardingSchemaName) {
- return regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("tables:\n");
+ if (regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("encryptRule:\n")) {
Review comment:
The rule configuration in registry center format is as follows when sharding only.
```
tables:
t_address:
actualDataNodes: ds_${0..1}.t_address
logicTable: t_address
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
databaseStrategy:
inline:
algorithmExpression: ds_${user_id % 2}
shardingColumn: user_id
keyGenerator:
column: order_id
type: SNOWFLAKE
logicTable: t_order
tableStrategy:
inline:
algorithmExpression: t_order_${order_id % 2}
shardingColumn: order_id
t_order_item:
actualDataNodes: ds_${0..1}.t_order_item_${0..1}
databaseStrategy:
inline:
algorithmExpression: ds_${user_id % 2}
shardingColumn: user_id
keyGenerator:
column: order_id
type: SNOWFLAKE
logicTable: t_order_item
tableStrategy:
inline:
algorithmExpression: t_order_item_${order_id % 2}
shardingColumn: order_id
```
We just make sure the rule is not encrypt only. the encrypt only rule configuration in registry center is as follows.
```
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
encryptor_md5:
type: md5
tables:
t_user:
columns:
user_name:
plainColumn: user_name
cipherColumn: user_name_plain
encryptor: encryptor_aes
```
The complex rule is as follows. it will be as shardingRule
```
tables:
t_user:
actualDataNodes: ds_${0..1}.t_user_${0..1}
databaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds_${user_id % 2}
tableStrategy:
inline:
shardingColumn: user_id
algorithmExpression: t_user_${user_id % 2}
keyGenerator:
type: SNOWFLAKE
column: user_id
defaultTableStrategy:
none:
defaultDatabaseStrategy:
none:
masterSlaveRules:
ds_0:
masterDataSourceName: ds_master_0
slaveDataSourceNames: [ds_master_0_slave_0, ds_master_0_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
ds_1:
masterDataSourceName: ds_master_1
slaveDataSourceNames: [ds_master_1_slave_0, ds_master_1_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
encryptRule:
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
tables:
t_user:
columns:
user_name:
plainColumn: user_name_plain
cipherColumn: user_name
encryptor: encryptor_aes
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] haetao commented on a change in pull
request #3824: Modify the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
haetao commented on a change in pull request #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824#discussion_r361834439
##########
File path: sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationService.java
##########
@@ -174,7 +174,13 @@ private boolean hasProperties() {
* @return is sharding rule or not
*/
public boolean isShardingRule(final String shardingSchemaName) {
- return regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("tables:\n");
+ if (regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("encryptRule:\n")) {
Review comment:
Here, In the judgement of sharding rule , we just make sure it's not encrypt only. All the complex scenes are sharding.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull
request #3824: Modify the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824#discussion_r361793479
##########
File path: sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationService.java
##########
@@ -174,7 +174,13 @@ private boolean hasProperties() {
* @return is sharding rule or not
*/
public boolean isShardingRule(final String shardingSchemaName) {
- return regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("tables:\n");
+ if (regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("encryptRule:\n")) {
Review comment:
Incorrect if sharding only
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] terrymanu merged pull request #3824:
Modify the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] haetao commented on issue #3824: Modify
the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
haetao commented on issue #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824#issuecomment-569269770
./run ci
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] haetao commented on a change in pull
request #3824: Modify the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
haetao commented on a change in pull request #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824#discussion_r361824668
##########
File path: sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationService.java
##########
@@ -174,7 +174,13 @@ private boolean hasProperties() {
* @return is sharding rule or not
*/
public boolean isShardingRule(final String shardingSchemaName) {
- return regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("tables:\n");
+ if (regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("encryptRule:\n")) {
Review comment:
The rule configuration in registry center format is as follows when sharding only.
```
tables:
t_address:
actualDataNodes: ds_${0..1}.t_address
logicTable: t_address
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
databaseStrategy:
inline:
algorithmExpression: ds_${user_id % 2}
shardingColumn: user_id
keyGenerator:
column: order_id
type: SNOWFLAKE
logicTable: t_order
tableStrategy:
inline:
algorithmExpression: t_order_${order_id % 2}
shardingColumn: order_id
t_order_item:
actualDataNodes: ds_${0..1}.t_order_item_${0..1}
databaseStrategy:
inline:
algorithmExpression: ds_${user_id % 2}
shardingColumn: user_id
keyGenerator:
column: order_id
type: SNOWFLAKE
logicTable: t_order_item
tableStrategy:
inline:
algorithmExpression: t_order_item_${order_id % 2}
shardingColumn: order_id
```
We just make sure the rule is not encrypt only. the encrypt only rule configuration in registry center is as follows.
```
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
encryptor_md5:
type: md5
tables:
t_user:
columns:
user_name:
plainColumn: user_name
cipherColumn: user_name_plain
encryptor: encryptor_aes
```
The complex rule is as follows. it will be as shardingRule
```
tables:
t_user:
actualDataNodes: ds_${0..1}.t_user_${0..1}
databaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds_${user_id % 2}
tableStrategy:
inline:
shardingColumn: user_id
algorithmExpression: t_user_${user_id % 2}
keyGenerator:
type: SNOWFLAKE
column: user_id
defaultTableStrategy:
none:
defaultDatabaseStrategy:
none:
masterSlaveRules:
ds_0:
masterDataSourceName: ds_master_0
slaveDataSourceNames: [ds_master_0_slave_0, ds_master_0_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
ds_1:
masterDataSourceName: ds_master_1
slaveDataSourceNames: [ds_master_1_slave_0, ds_master_1_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
encryptRule:
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
tables:
t_user:
columns:
user_name:
plainColumn: user_name_plain
cipherColumn: user_name
encryptor: encryptor_aes
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] coveralls commented on issue #3824:
Modify the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
coveralls commented on issue #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824#issuecomment-569485640
## Pull Request Test Coverage Report for [Build 1247](https://coveralls.io/builds/27831573)
* **7** of **8** **(87.5%)** changed or added relevant lines in **1** file are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage increased (+**0.3%**) to **67.553%**
---
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
| :-----|--------------|--------|---: |
| [sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationService.java](https://coveralls.io/builds/27831573/source?filename=sharding-orchestration%2Fsharding-orchestration-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Finternal%2Fregistry%2Fconfig%2Fservice%2FConfigurationService.java#L178) | 7 | 8 | 87.5%
<!-- | **Total:** | **7** | **8** | **87.5%** | -->
| Totals | [![Coverage Status](https://coveralls.io/builds/27831573/badge)](https://coveralls.io/builds/27831573) |
| :-- | --: |
| Change from base [Build 634](https://coveralls.io/builds/27808868): | 0.3% |
| Covered Lines: | 11280 |
| Relevant Lines: | 16698 |
---
##### 💛 - [Coveralls](https://coveralls.io)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] haetao commented on a change in pull
request #3824: Modify the way to identify Rule Configuration in Config Center
Posted by GitBox <gi...@apache.org>.
haetao commented on a change in pull request #3824: Modify the way to identify Rule Configuration in Config Center
URL: https://github.com/apache/incubator-shardingsphere/pull/3824#discussion_r361834834
##########
File path: sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationService.java
##########
@@ -174,7 +174,13 @@ private boolean hasProperties() {
* @return is sharding rule or not
*/
public boolean isShardingRule(final String shardingSchemaName) {
- return regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("tables:\n");
+ if (regCenter.getDirectly(configNode.getRulePath(shardingSchemaName)).contains("encryptRule:\n")) {
Review comment:
The difference of Rule Configuration in registry center in encrypt only and cmplex scene is as follows:
**encrypt only**
```
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
encryptor_md5:
type: md5
tables:
t_user:
columns:
user_name:
plainColumn: user_name_plain
cipherColumn: user_name
encryptor: encryptor_md5
```
**complex scene**
```
tables:
t_user:
actualDataNodes: ds_${0..1}.t_user_${0..1}
databaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds_${user_id % 2}
tableStrategy:
inline:
shardingColumn: user_id
algorithmExpression: t_user_${user_id % 2}
keyGenerator:
type: SNOWFLAKE
column: user_id
defaultTableStrategy:
none:
defaultDatabaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds_${user_id % 2}
masterSlaveRules:
ds_0:
masterDataSourceName: ds_master_0
slaveDataSourceNames: [ds_master_0_slave_0, ds_master_0_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
ds_1:
masterDataSourceName: ds_master_1
slaveDataSourceNames: [ds_master_1_slave_0, ds_master_1_slave_1]
loadBalanceAlgorithmType: ROUND_ROBIN
encryptRule:
encryptors:
encryptor_aes:
type: aes
props:
aes.key.value: 123456abc
tables:
t_user:
columns:
user_name:
plainColumn: user_name_plain
cipherColumn: user_name
encryptor: encryptor_aes
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services