totalo commented on a change in pull request #10465:
URL: https://github.com/apache/shardingsphere/pull/10465#discussion_r639407989
##########
File path:
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/impl/DropShardingTableRuleBackendHandler.java
##########
@@ -49,24 +49,23 @@ public DropShardingTableRuleBackendHandler(final
DropShardingTableRuleStatement
@Override
public ResponseHeader execute(final String schemaName, final
DropShardingTableRuleStatement sqlStatement) {
Collection<String> tableNames =
sqlStatement.getTableNames().stream().map(each ->
each.getIdentifier().getValue()).collect(Collectors.toList());
- ShardingRuleConfiguration shardingRuleConfiguration =
check(schemaName, tableNames);
- drop(shardingRuleConfiguration, tableNames);
+ Optional<ShardingRuleConfiguration> shardingRuleConfiguration =
getShardingRuleConfiguration(schemaName);
+ check(schemaName, shardingRuleConfiguration, tableNames);
+ drop(shardingRuleConfiguration.get(), tableNames);
post(schemaName);
return new UpdateResponseHeader(sqlStatement);
}
- private ShardingRuleConfiguration check(final String schemaName, final
Collection<String> tableNames) {
- Optional<ShardingRuleConfiguration> shardingRuleConfiguration =
getShardingRuleConfiguration(schemaName);
+ private void check(final String schemaName, final
Optional<ShardingRuleConfiguration> shardingRuleConfiguration, final
Collection<String> tableNames) {
if (!shardingRuleConfiguration.isPresent()) {
throw new ShardingTableRuleNotExistedException(schemaName,
tableNames);
}
Collection<String> shardingTableNames =
getShardingTables(shardingRuleConfiguration.get());
- Collection<String> notExistedTableNames =
tableNames.stream().filter(each ->
!shardingTableNames.contains(each)).collect(Collectors.toList());
- if (!notExistedTableNames.isEmpty()) {
- throw new ShardingTableRuleNotExistedException(schemaName,
notExistedTableNames);
+ Collection<String> bindingTables =
getBindingTables(shardingRuleConfiguration.get());
+ Collection<String> notSatisfiedTableNames =
tableNames.stream().filter(each -> !shardingTableNames.contains(each) ||
bindingTables.contains(each)).collect(Collectors.toList());
Review comment:
Sorry, my negligence, I misunderstood the exception name.i will fix it!
--
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]