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/05 09:21:05 UTC
[GitHub] [shardingsphere] jingshanglu opened a new pull request #8894: add support drop resource
jingshanglu opened a new pull request #8894:
URL: https://github.com/apache/shardingsphere/pull/8894
Fixes #8802 .
----------------------------------------------------------------
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 #8894: add support drop resource
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #8894:
URL: https://github.com/apache/shardingsphere/pull/8894#issuecomment-754553197
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8894?src=pr&el=h1) Report
> Merging [#8894](https://codecov.io/gh/apache/shardingsphere/pull/8894?src=pr&el=desc) (c3a41b1) into [master](https://codecov.io/gh/apache/shardingsphere/commit/50784a276555c593218525c0aa5eed923a3524e1?el=desc) (50784a2) will **decrease** coverage by `0.41%`.
> The diff coverage is `6.15%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/8894/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/8894?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #8894 +/- ##
============================================
- Coverage 69.61% 69.20% -0.42%
+ Complexity 627 625 -2
============================================
Files 1618 1621 +3
Lines 25841 25925 +84
Branches 4496 4512 +16
============================================
- Hits 17990 17941 -49
- Misses 6646 6767 +121
- Partials 1205 1217 +12
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8894?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...dingsphere/distsql/parser/core/DistSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItZW5naW5lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9jb3JlL0Rpc3RTUUxWaXNpdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...statement/rdl/drop/impl/DropResourceStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXIvc2hhcmRpbmdzcGhlcmUtZGlzdHNxbC1wYXJzZXItc3RhdGVtZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kaXN0c3FsL3BhcnNlci9zdGF0ZW1lbnQvcmRsL2Ryb3AvaW1wbC9Ecm9wUmVzb3VyY2VTdGF0ZW1lbnQuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...end/text/distsql/rdl/RDLBackendHandlerFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL1JETEJhY2tlbmRIYW5kbGVyRmFjdG9yeS5qYXZh) | `61.53% <0.00%> (-5.13%)` | `0.00 <0.00> (ø)` | |
| [...t/distsql/rdl/impl/DropResourceBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmRsL2ltcGwvRHJvcFJlc291cmNlQmFja2VuZEhhbmRsZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...re/proxy/frontend/mysql/MySQLErrPacketFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3Byb3h5L2Zyb250ZW5kL215c3FsL015U1FMRXJyUGFja2V0RmFjdG9yeS5qYXZh) | `80.95% <0.00%> (-8.53%)` | `0.00 <0.00> (ø)` | |
| [...rdingsphere/db/protocol/error/CommonErrorCode.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZGIvcHJvdG9jb2wvZXJyb3IvQ29tbW9uRXJyb3JDb2RlLmphdmE=) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...ingsphere/governance/core/config/ConfigCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9jb25maWcvQ29uZmlnQ2VudGVyLmphdmE=) | `71.25% <100.00%> (+2.01%)` | `0.00 <0.00> (ø)` | |
| [...agent/core/config/yaml/YamlAgentConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9jb25maWcveWFtbC9ZYW1sQWdlbnRDb25maWd1cmF0aW9uLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
| [...gent/core/config/yaml/YamlPluginConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9jb25maWcveWFtbC9ZYW1sUGx1Z2luQ29uZmlndXJhdGlvbi5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
| [...t/core/config/loader/AgentConfigurationLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9jb25maWcvbG9hZGVyL0FnZW50Q29uZmlndXJhdGlvbkxvYWRlci5qYXZh) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
| ... and [172 more](https://codecov.io/gh/apache/shardingsphere/pull/8894/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8894?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/8894?src=pr&el=footer). Last update [50784a2...c3a41b1](https://codecov.io/gh/apache/shardingsphere/pull/8894?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] tristaZero commented on a change in pull request #8894: add support drop resource
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #8894:
URL: https://github.com/apache/shardingsphere/pull/8894#discussion_r552352316
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/exception/ResourceInUsedException.java
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.exception;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+import java.util.Collection;
+
+/**
+ * datasource in used exception.
Review comment:
Please capitalize the first letter.
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -33,6 +33,10 @@
TABLES_IN_USED(11002, "C11002", "Can not drop rule, tables %s in the rule are still in used."),
+ RESOURCE_IN_USED(11003, "C11003", "Can not drop resource, resources %s in the rule are still in used."),
Review comment:
Can not drop resource, resources?
One or multiple?
##########
File path: shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
##########
@@ -118,6 +119,16 @@ public void persistGlobalConfiguration(final DefaultAuthentication authenticatio
public synchronized void renew(final DataSourcePersistEvent event) {
addDataSourceConfigurations(event.getSchemaName(), event.getDataSourceConfigurations());
}
+
+ /**
+ * change data source configurations.
+ * @param event Data source event.
+ */
+ @Subscribe
+ public synchronized void renew(final DataSourceChangedEvent event) {
+
Review comment:
Please remove the blank line.
##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropResourceBackendHandler.java
##########
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.impl;
+
+import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropResourceStatement;
+import org.apache.shardingsphere.governance.core.event.model.datasource.DataSourceChangedEvent;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
+import org.apache.shardingsphere.infra.config.datasource.DataSourceConverter;
+import org.apache.shardingsphere.infra.datanode.DataNode;
+import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.rule.type.DataNodeContainedRule;
+import org.apache.shardingsphere.infra.rule.type.DataSourceContainedRule;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.backend.exception.ResourceNotExistedException;
+import org.apache.shardingsphere.proxy.backend.exception.ResourceInUsedException;
+import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
+import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
+import org.apache.shardingsphere.proxy.backend.text.SchemaRequiredBackendHandler;
+
+import javax.sql.DataSource;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Drop resource backend handler.
+ */
+public final class DropResourceBackendHandler extends SchemaRequiredBackendHandler<DropResourceStatement> {
Review comment:
Is there any unit test?
----------------------------------------------------------------
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] tristaZero commented on a change in pull request #8894: add support drop resource
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #8894:
URL: https://github.com/apache/shardingsphere/pull/8894#discussion_r553345769
##########
File path: shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/config/ConfigCenter.java
##########
@@ -113,6 +114,15 @@ public void persistGlobalConfiguration(final DefaultAuthentication authenticatio
public synchronized void renew(final DataSourcePersistEvent event) {
addDataSourceConfigurations(event.getSchemaName(), event.getDataSourceConfigurations());
}
+
+ /**
+ * change data source configurations.
Review comment:
change - > Change
##########
File path: shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/error/CommonErrorCode.java
##########
@@ -32,6 +32,10 @@
SHARDING_TABLE_RULES_NOT_EXISTED(11001, "C11001", "Sharding table rule %s is not exist."),
TABLES_IN_USED(11002, "C11002", "Can not drop rule, tables %s in the rule are still in used."),
+
+ RESOURCE_IN_USED(11003, "C11003", "Can not drop resources, resources %s in the rule are still in used."),
+
+ RESOURCE_NOT_EXIST(11004, "C11004", "Can not drop resources, resources %s not exist."),
Review comment:
resources %s do not exist.
----------------------------------------------------------------
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] tristaZero merged pull request #8894: add support drop resource
Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #8894:
URL: https://github.com/apache/shardingsphere/pull/8894
----------------------------------------------------------------
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