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 2021/01/12 10:40:21 UTC
[GitHub] [shardingsphere] jingshanglu opened a new pull request #8997: support add feature in "alter replica_query rule"
jingshanglu opened a new pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997
Fixes #8979 .
----------------------------------------------------------------
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
[GitHub] [shardingsphere] codecov-io commented on pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997#issuecomment-759887361
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=h1) Report
> Merging [#8997](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=desc) (159972c) into [master](https://codecov.io/gh/apache/shardingsphere/commit/86b1ab4f38013d89c43a61011614ac5aaee922d4?el=desc) (86b1ab4) will **decrease** coverage by `0.15%`.
> The diff coverage is `10.76%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/8997/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #8997 +/- ##
============================================
- Coverage 70.24% 70.08% -0.16%
- Complexity 652 655 +3
============================================
Files 1633 1635 +2
Lines 26209 26366 +157
Branches 4565 4598 +33
============================================
+ Hits 18410 18479 +69
- Misses 6556 6624 +68
- Partials 1243 1263 +20
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...dingsphere/distsql/parser/core/DistSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItZW5naW5lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9jb3JlL0Rpc3RTUUxWaXNpdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...erter/AlterReplicaQueryRuleStatementConverter.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVwbGljYS1xdWVyeS9zaGFyZGluZ3NwaGVyZS1yZXBsaWNhLXF1ZXJ5LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcmVwbGljYXF1ZXJ5L3lhbWwvY29udmVydGVyL0FsdGVyUmVwbGljYVF1ZXJ5UnVsZVN0YXRlbWVudENvbnZlcnRlci5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...re/proxy/frontend/mysql/MySQLErrPacketFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3Byb3h5L2Zyb250ZW5kL215c3FsL015U1FMRXJyUGFja2V0RmFjdG9yeS5qYXZh) | `70.83% <0.00%> (-10.12%)` | `0.00 <0.00> (ø)` | |
| [.../rdl/impl/AlterReplicaQueryRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvQWx0ZXJSZXBsaWNhUXVlcnlSdWxlQmFja2VuZEhhbmRsZXIuamF2YQ==) | `10.00% <6.66%> (-7.78%)` | `1.00 <0.00> (ø)` | |
| [...l/rdl/impl/DropReplicaQueryRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvRHJvcFJlcGxpY2FRdWVyeVJ1bGVCYWNrZW5kSGFuZGxlci5qYXZh) | `27.58% <50.00%> (ø)` | `1.00 <0.00> (ø)` | |
| [...rdingsphere/db/protocol/error/CommonErrorCode.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGIvcHJvdG9jb2wvZXJyb3IvQ29tbW9uRXJyb3JDb2RlLmphdmE=) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...zipkin/service/ZipkinTracingPluginBootService.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tdHJhY2luZy9zaGFyZGluZ3NwaGVyZS1hZ2VudC10cmFjaW5nLXppcGtpbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvcGx1Z2luL3RyYWNpbmcvemlwa2luL3NlcnZpY2UvWmlwa2luVHJhY2luZ1BsdWdpbkJvb3RTZXJ2aWNlLmphdmE=) | `83.33% <0.00%> (-16.67%)` | `1.00% <0.00%> (ø%)` | |
| [...caling/core/service/AbstractScalingJobService.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9zZXJ2aWNlL0Fic3RyYWN0U2NhbGluZ0pvYlNlcnZpY2UuamF2YQ==) | `52.77% <0.00%> (-9.30%)` | `0.00% <0.00%> (-1.00%)` | |
| [...rce/ShardingSphereJDBCDataSourceConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9jb25maWcvZGF0YXNvdXJjZS9TaGFyZGluZ1NwaGVyZUpEQkNEYXRhU291cmNlQ29uZmlndXJhdGlvbi5qYXZh) | `91.66% <0.00%> (-8.34%)` | `1.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...rometheus/service/PrometheusPluginBootService.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L21ldHJpY3MvcHJvbWV0aGV1cy9zZXJ2aWNlL1Byb21ldGhldXNQbHVnaW5Cb290U2VydmljZS5qYXZh) | `75.86% <0.00%> (-7.48%)` | `1.00% <0.00%> (ø%)` | |
| ... and [56 more](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=footer). Last update [86b1ab4...159972c](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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
[GitHub] [shardingsphere] codecov-io edited a comment on pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997#issuecomment-759887361
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=h1) Report
> Merging [#8997](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=desc) (06ef502) into [master](https://codecov.io/gh/apache/shardingsphere/commit/1e476044ade7964f6b036305529f302a010fe680?el=desc) (1e47604) will **decrease** coverage by `0.15%`.
> The diff coverage is `9.45%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/8997/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #8997 +/- ##
============================================
- Coverage 70.19% 70.03% -0.16%
- Complexity 655 658 +3
============================================
Files 1635 1635
Lines 26326 26394 +68
Branches 4591 4604 +13
============================================
+ Hits 18479 18486 +7
- Misses 6585 6642 +57
- Partials 1262 1266 +4
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...dingsphere/distsql/parser/core/DistSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItZW5naW5lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9jb3JlL0Rpc3RTUUxWaXNpdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...erter/AlterReplicaQueryRuleStatementConverter.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVwbGljYS1xdWVyeS9zaGFyZGluZ3NwaGVyZS1yZXBsaWNhLXF1ZXJ5LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcmVwbGljYXF1ZXJ5L3lhbWwvY29udmVydGVyL0FsdGVyUmVwbGljYVF1ZXJ5UnVsZVN0YXRlbWVudENvbnZlcnRlci5qYXZh) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...rter/CreateReplicaQueryRuleStatementConverter.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVwbGljYS1xdWVyeS9zaGFyZGluZ3NwaGVyZS1yZXBsaWNhLXF1ZXJ5LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcmVwbGljYXF1ZXJ5L3lhbWwvY29udmVydGVyL0NyZWF0ZVJlcGxpY2FRdWVyeVJ1bGVTdGF0ZW1lbnRDb252ZXJ0ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...re/proxy/frontend/mysql/MySQLErrPacketFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3Byb3h5L2Zyb250ZW5kL215c3FsL015U1FMRXJyUGFja2V0RmFjdG9yeS5qYXZh) | `68.00% <0.00%> (-9.28%)` | `0.00 <0.00> (ø)` | |
| [.../rdl/impl/AlterReplicaQueryRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvQWx0ZXJSZXBsaWNhUXVlcnlSdWxlQmFja2VuZEhhbmRsZXIuamF2YQ==) | `10.00% <6.52%> (-7.78%)` | `1.00 <0.00> (ø)` | |
| [...l/rdl/impl/DropReplicaQueryRuleBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvRHJvcFJlcGxpY2FRdWVyeVJ1bGVCYWNrZW5kSGFuZGxlci5qYXZh) | `27.58% <50.00%> (ø)` | `1.00 <0.00> (ø)` | |
| [...rdingsphere/db/protocol/error/CommonErrorCode.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGIvcHJvdG9jb2wvZXJyb3IvQ29tbW9uRXJyb3JDb2RlLmphdmE=) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...phere/governance/core/config/ConfigCenterNode.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9jb25maWcvQ29uZmlnQ2VudGVyTm9kZS5qYXZh) | `52.77% <0.00%> (-38.14%)` | `0.00% <0.00%> (ø%)` | |
| [...pository/zookeeper/CuratorZookeeperRepository.java](https://codecov.io/gh/apache/shardingsphere/pull/8997/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLXJlcG9zaXRvcnkvc2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS1yZXBvc2l0b3J5LXByb3ZpZGVyL3NoYXJkaW5nc3BoZXJlLWdvdmVybmFuY2UtcmVwb3NpdG9yeS16b29rZWVwZXItY3VyYXRvci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZ292ZXJuYW5jZS9yZXBvc2l0b3J5L3pvb2tlZXBlci9DdXJhdG9yWm9va2VlcGVyUmVwb3NpdG9yeS5qYXZh) | `72.05% <0.00%> (-0.04%)` | `31.00% <0.00%> (+3.00%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=footer). Last update [1e47604...06ef502](https://codecov.io/gh/apache/shardingsphere/pull/8997?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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
[GitHub] [shardingsphere] terrymanu commented on pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
terrymanu commented on pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997#issuecomment-758706736
Please add label and milestone
----------------------------------------------------------------
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
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997#discussion_r556210022
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -37,6 +37,12 @@
RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s do not exist."),
+ REPLICA_QUERY_RULE_NOT_EXIST(11005, "C11005", "Replica query rule do not exist."),
Review comment:
ok
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -37,6 +37,12 @@
RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s do not exist."),
+ REPLICA_QUERY_RULE_NOT_EXIST(11005, "C11005", "Replica query rule do not exist."),
+
+ REPLICA_QUERY_RULE_DATASOURCE_NOT_EXIST(11006, "C11006", "Datasource %s in Replica query rule do not exist."),
Review comment:
ok
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -37,6 +37,12 @@
RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s do not exist."),
+ REPLICA_QUERY_RULE_NOT_EXIST(11005, "C11005", "Replica query rule do not exist."),
+
+ REPLICA_QUERY_RULE_DATASOURCE_NOT_EXIST(11006, "C11006", "Datasource %s in Replica query rule do not exist."),
Review comment:
ok
----------------------------------------------------------------
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
[GitHub] [shardingsphere] terrymanu commented on a change in pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997#discussion_r556243507
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterReplicaQueryRuleBackendHandler.java
##########
@@ -49,34 +57,73 @@
public AlterReplicaQueryRuleBackendHandler(final AlterReplicaQueryRuleStatement sqlStatement, final BackendConnection backendConnection) {
super(sqlStatement, backendConnection);
}
-
+
@Override
public ResponseHeader execute(final String schemaName, final AlterReplicaQueryRuleStatement sqlStatement) {
- YamlReplicaQueryRuleConfiguration config = AlterReplicaQueryRuleStatementConverter.convert(sqlStatement);
- check(config, schemaName);
- YamlReplicaQueryRuleConfiguration alterConfig = alter(config, schemaName);
- Collection<RuleConfiguration> rules = new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(Collections.singleton(alterConfig));
+ check(sqlStatement, schemaName);
+ YamlReplicaQueryRuleConfiguration alterConfig = alter(sqlStatement, schemaName);
+ YamlReplicaQueryRuleConfiguration addConfig = add(alterConfig, sqlStatement, schemaName);
+ Collection<RuleConfiguration> rules = new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(Collections.singleton(addConfig));
post(schemaName, rules);
return new UpdateResponseHeader(sqlStatement);
}
-
- private void check(final YamlReplicaQueryRuleConfiguration config, final String schemaName) {
-// TODO Check whether the database exists
+
+ private void check(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
+ checkRuleExist(schemaName);
+ checkAddDatasourceExist(statement, schemaName);
+ checkModifyDatasourceNotExist(statement, schemaName);
+ checkResourceExist(statement, schemaName);
+ }
+
+ private void checkRuleExist(final String schemaName) {
Optional<ReplicaQueryRuleConfiguration> replicaQueryRuleConfig = ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations().stream()
.filter(each -> each instanceof ReplicaQueryRuleConfiguration).map(each -> (ReplicaQueryRuleConfiguration) each).findFirst();
if (!replicaQueryRuleConfig.isPresent()) {
- throw new ReplicaQueryRuleNotExistedException(config.getDataSources().keySet());
+ throw new ReplicaQueryRuleNotExistedException();
}
+ }
+
+ private void checkAddDatasourceExist(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
+ Optional<ReplicaQueryRuleConfiguration> replicaQueryRuleConfig = ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations().stream()
+ .filter(each -> each instanceof ReplicaQueryRuleConfiguration).map(each -> (ReplicaQueryRuleConfiguration) each).findFirst();
Set<String> existReplicaQueryDatasourceNames = replicaQueryRuleConfig.get().getDataSources().stream().map(each -> each.getName()).collect(Collectors.toSet());
- Collection<String> notExistReplicaQueryDatasourceNames = config.getDataSources().keySet().stream().filter(each -> !existReplicaQueryDatasourceNames.contains(each))
- .collect(Collectors.toList());
- if (!notExistReplicaQueryDatasourceNames.isEmpty()) {
- throw new ReplicaQueryRuleNotExistedException(notExistReplicaQueryDatasourceNames);
+ Collection<String> addExistReplicaQueryDatasourceNames = statement.getAddReplicaQueryRules().stream().map(each -> each.getName())
+ .filter(each -> existReplicaQueryDatasourceNames.contains(each)).collect(Collectors.toList());
+ if (!addExistReplicaQueryDatasourceNames.isEmpty()) {
+ throw new AddReplicaQueryRuleDatasourcesExistedException(addExistReplicaQueryDatasourceNames);
}
}
-
- private YamlReplicaQueryRuleConfiguration alter(final YamlReplicaQueryRuleConfiguration config, final String schemaName) {
- YamlReplicaQueryRuleConfiguration result = config;
+
+ private void checkResourceExist(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
+ List<String> resources = new LinkedList<>();
+ for (ReplicaQueryRuleSegment each: statement.getModifyReplicaQueryRules()) {
+ resources.add(each.getPrimaryDatasource());
+ resources.addAll(each.getReplicaDatasources());
+ }
+ for (ReplicaQueryRuleSegment each: statement.getAddReplicaQueryRules()) {
+ resources.add(each.getPrimaryDatasource());
+ resources.addAll(each.getReplicaDatasources());
+ }
+ Map<String, DataSource> datasourceMap = ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources();
+ Collection<String> notExistResource = resources.stream().filter(each -> !datasourceMap.containsKey(each)).collect(Collectors.toList());
+ if (!notExistResource.isEmpty()) {
+ throw new ResourceNotExistedException(notExistResource);
+ }
+ }
+
+ private void checkModifyDatasourceNotExist(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
Review comment:
Data source are 2 words
----------------------------------------------------------------
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
[GitHub] [shardingsphere] terrymanu commented on a change in pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997#discussion_r555826878
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -37,6 +37,12 @@
RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s do not exist."),
+ REPLICA_QUERY_RULE_NOT_EXIST(11005, "C11005", "Replica query rule do not exist."),
+
+ REPLICA_QUERY_RULE_DATASOURCE_NOT_EXIST(11006, "C11006", "Datasource %s in Replica query rule do not exist."),
Review comment:
`Replica` should be lower case if not in the first word of sentence.
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -37,6 +37,12 @@
RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s do not exist."),
+ REPLICA_QUERY_RULE_NOT_EXIST(11005, "C11005", "Replica query rule do not exist."),
Review comment:
`do not` should be `does not`
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -37,6 +37,12 @@
RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s do not exist."),
+ REPLICA_QUERY_RULE_NOT_EXIST(11005, "C11005", "Replica query rule do not exist."),
+
+ REPLICA_QUERY_RULE_DATASOURCE_NOT_EXIST(11006, "C11006", "Datasource %s in Replica query rule do not exist."),
Review comment:
data source are 2 words
----------------------------------------------------------------
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
[GitHub] [shardingsphere] jingshanglu commented on a change in pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on a change in pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997#discussion_r556495575
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/AlterReplicaQueryRuleBackendHandler.java
##########
@@ -49,34 +57,73 @@
public AlterReplicaQueryRuleBackendHandler(final AlterReplicaQueryRuleStatement sqlStatement, final BackendConnection backendConnection) {
super(sqlStatement, backendConnection);
}
-
+
@Override
public ResponseHeader execute(final String schemaName, final AlterReplicaQueryRuleStatement sqlStatement) {
- YamlReplicaQueryRuleConfiguration config = AlterReplicaQueryRuleStatementConverter.convert(sqlStatement);
- check(config, schemaName);
- YamlReplicaQueryRuleConfiguration alterConfig = alter(config, schemaName);
- Collection<RuleConfiguration> rules = new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(Collections.singleton(alterConfig));
+ check(sqlStatement, schemaName);
+ YamlReplicaQueryRuleConfiguration alterConfig = alter(sqlStatement, schemaName);
+ YamlReplicaQueryRuleConfiguration addConfig = add(alterConfig, sqlStatement, schemaName);
+ Collection<RuleConfiguration> rules = new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(Collections.singleton(addConfig));
post(schemaName, rules);
return new UpdateResponseHeader(sqlStatement);
}
-
- private void check(final YamlReplicaQueryRuleConfiguration config, final String schemaName) {
-// TODO Check whether the database exists
+
+ private void check(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
+ checkRuleExist(schemaName);
+ checkAddDatasourceExist(statement, schemaName);
+ checkModifyDatasourceNotExist(statement, schemaName);
+ checkResourceExist(statement, schemaName);
+ }
+
+ private void checkRuleExist(final String schemaName) {
Optional<ReplicaQueryRuleConfiguration> replicaQueryRuleConfig = ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations().stream()
.filter(each -> each instanceof ReplicaQueryRuleConfiguration).map(each -> (ReplicaQueryRuleConfiguration) each).findFirst();
if (!replicaQueryRuleConfig.isPresent()) {
- throw new ReplicaQueryRuleNotExistedException(config.getDataSources().keySet());
+ throw new ReplicaQueryRuleNotExistedException();
}
+ }
+
+ private void checkAddDatasourceExist(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
+ Optional<ReplicaQueryRuleConfiguration> replicaQueryRuleConfig = ProxyContext.getInstance().getMetaData(schemaName).getRuleMetaData().getConfigurations().stream()
+ .filter(each -> each instanceof ReplicaQueryRuleConfiguration).map(each -> (ReplicaQueryRuleConfiguration) each).findFirst();
Set<String> existReplicaQueryDatasourceNames = replicaQueryRuleConfig.get().getDataSources().stream().map(each -> each.getName()).collect(Collectors.toSet());
- Collection<String> notExistReplicaQueryDatasourceNames = config.getDataSources().keySet().stream().filter(each -> !existReplicaQueryDatasourceNames.contains(each))
- .collect(Collectors.toList());
- if (!notExistReplicaQueryDatasourceNames.isEmpty()) {
- throw new ReplicaQueryRuleNotExistedException(notExistReplicaQueryDatasourceNames);
+ Collection<String> addExistReplicaQueryDatasourceNames = statement.getAddReplicaQueryRules().stream().map(each -> each.getName())
+ .filter(each -> existReplicaQueryDatasourceNames.contains(each)).collect(Collectors.toList());
+ if (!addExistReplicaQueryDatasourceNames.isEmpty()) {
+ throw new AddReplicaQueryRuleDatasourcesExistedException(addExistReplicaQueryDatasourceNames);
}
}
-
- private YamlReplicaQueryRuleConfiguration alter(final YamlReplicaQueryRuleConfiguration config, final String schemaName) {
- YamlReplicaQueryRuleConfiguration result = config;
+
+ private void checkResourceExist(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
+ List<String> resources = new LinkedList<>();
+ for (ReplicaQueryRuleSegment each: statement.getModifyReplicaQueryRules()) {
+ resources.add(each.getPrimaryDatasource());
+ resources.addAll(each.getReplicaDatasources());
+ }
+ for (ReplicaQueryRuleSegment each: statement.getAddReplicaQueryRules()) {
+ resources.add(each.getPrimaryDatasource());
+ resources.addAll(each.getReplicaDatasources());
+ }
+ Map<String, DataSource> datasourceMap = ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources();
+ Collection<String> notExistResource = resources.stream().filter(each -> !datasourceMap.containsKey(each)).collect(Collectors.toList());
+ if (!notExistResource.isEmpty()) {
+ throw new ResourceNotExistedException(notExistResource);
+ }
+ }
+
+ private void checkModifyDatasourceNotExist(final AlterReplicaQueryRuleStatement statement, final String schemaName) {
Review comment:
ok
----------------------------------------------------------------
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
[GitHub] [shardingsphere] terrymanu merged pull request #8997: support add feature in "alter replica_query rule"
Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #8997:
URL: https://github.com/apache/shardingsphere/pull/8997
----------------------------------------------------------------
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