This is an automated email from the ASF dual-hosted git repository.

jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 840ef16ad3d Update CreateDefaultShadowAlgorithmStatementUpdater.java 
(#23044)
840ef16ad3d is described below

commit 840ef16ad3d83ae9a5c3a4de5eccc7a715df23a3
Author: yx9o <[email protected]>
AuthorDate: Fri Dec 23 23:09:08 2022 +0800

    Update CreateDefaultShadowAlgorithmStatementUpdater.java (#23044)
---
 .../update/CreateDefaultShadowAlgorithmStatementUpdater.java       | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git 
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
 
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
index 317c606ab64..e52d8e1b948 100644
--- 
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
+++ 
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmStatementUpdater.java
@@ -44,8 +44,6 @@ public final class 
CreateDefaultShadowAlgorithmStatementUpdater implements RuleD
     
     private static final String DEFAULT_ALGORITHM_NAME = 
"default_shadow_algorithm";
     
-    private boolean ifNotExists;
-    
     @Override
     public RuleConfiguration buildToBeCreatedRuleConfiguration(final 
CreateDefaultShadowAlgorithmStatement sqlStatement) {
         ShadowRuleConfiguration result = new ShadowRuleConfiguration();
@@ -61,7 +59,7 @@ public final class 
CreateDefaultShadowAlgorithmStatementUpdater implements RuleD
     
     @Override
     public void updateCurrentRuleConfiguration(final ShadowRuleConfiguration 
currentRuleConfig, final ShadowRuleConfiguration toBeCreatedRuleConfig) {
-        if (!ifNotExists) {
+        if (getIdentical(currentRuleConfig).isEmpty()) {
             
currentRuleConfig.getShadowAlgorithms().putAll(toBeCreatedRuleConfig.getShadowAlgorithms());
             
currentRuleConfig.setDefaultShadowAlgorithmName(toBeCreatedRuleConfig.getDefaultShadowAlgorithmName());
         }
@@ -69,8 +67,7 @@ public final class 
CreateDefaultShadowAlgorithmStatementUpdater implements RuleD
     
     @Override
     public void checkSQLStatement(final ShardingSphereDatabase database, final 
CreateDefaultShadowAlgorithmStatement sqlStatement, final 
ShadowRuleConfiguration currentRuleConfig) {
-        ifNotExists = sqlStatement.isIfNotExists();
-        if (!ifNotExists) {
+        if (!sqlStatement.isIfNotExists()) {
             checkExist(database.getName(), currentRuleConfig);
         }
         
checkAlgorithmCompleteness(Collections.singleton(sqlStatement.getShadowAlgorithmSegment().getAlgorithmSegment()));

Reply via email to