RaigorJiang opened a new issue #11634:
URL: https://github.com/apache/shardingsphere/issues/11634


   1. In the previous PR #11151, `RDLAlterUpdater` defines the interface
   ```java
   void updateCurrentRuleConfiguration(R currentRuleConfig, R 
toBeAlteredRuleConfig);
   ```
   But when `RDLBackendHandler` calls this interface, the order of the 
parameters is wrong.
   ```java
   updater.updateCurrentRuleConfiguration(toBeAlteredRuleConfig, 
currentRuleConfig);
   ```
   
   2. At the same time, the method 
`AlterShardingTableRuleStatementUpdater#dropRuleConfiguration`
   has also been modified incorrectly.
   ```java
   private void dropRuleConfiguration(final ShardingRuleConfiguration 
currentRuleConfig, final ShardingRuleConfiguration toBeAlteredRuleConfig) {
           for (ShardingTableRuleConfiguration each : 
toBeAlteredRuleConfig.getTables()) {
               Optional<ShardingAutoTableRuleConfiguration> 
shardingAutoTableRuleConfig
                       = 
currentRuleConfig.getAutoTables().stream().filter(tableRule -> 
each.getLogicTable().equals(tableRule.getLogicTable())).findAny();
               
Preconditions.checkState(shardingAutoTableRuleConfig.isPresent());
               
currentRuleConfig.getAutoTables().remove(shardingAutoTableRuleConfig.get());
               
currentRuleConfig.getShardingAlgorithms().remove(shardingAutoTableRuleConfig.get().getShardingStrategy().getShardingAlgorithmName());
               if (null != 
shardingAutoTableRuleConfig.get().getKeyGenerateStrategy()) {
                   
currentRuleConfig.getKeyGenerators().remove(shardingAutoTableRuleConfig.get().getKeyGenerateStrategy().getKeyGeneratorName());
               }
           }
       }
   ```
   The line 
   ```java
   for (ShardingTableRuleConfiguration each : 
toBeAlteredRuleConfig.getTables()) {
   ```
   should be:
   ```java
   for (ShardingAutoTableRuleConfiguration each : 
toBeAlteredRuleConfig.getAutoTables()) {
   ```
   
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to