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: [email protected]
