You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2024/05/10 12:42:44 UTC

(shardingsphere) branch master updated: Refactor RuleItemChangedSubscriber (#31196)

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

sunnianjun 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 858e5f49e1c Refactor RuleItemChangedSubscriber (#31196)
858e5f49e1c is described below

commit 858e5f49e1ca3fd1a4f9f30f4a3f6376d139112c
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri May 10 20:42:37 2024 +0800

    Refactor RuleItemChangedSubscriber (#31196)
---
 .../mode/subsciber/RuleItemChangedSubscriber.java      | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java
index e16b8d7eeb1..28c02926d78 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/subsciber/RuleItemChangedSubscriber.java
@@ -52,14 +52,7 @@ public final class RuleItemChangedSubscriber {
         RuleConfiguration currentRuleConfig = processor.findRuleConfiguration(contextManager.getMetaDataContexts().getMetaData().getDatabase(databaseName));
         synchronized (this) {
             processor.changeRuleItemConfiguration(event, currentRuleConfig, processor.swapRuleItemConfiguration(event, yamlContent));
-            // TODO Remove isCluster judgment
-            if (contextManager.getInstanceContext().isCluster()) {
-                if (contextManager.getMetaDataContexts().getMetaData().containsDatabase(databaseName)) {
-                    contextManager.getConfigurationContextManager().alterRuleConfiguration(databaseName, currentRuleConfig);
-                }
-            } else {
-                contextManager.getConfigurationContextManager().alterRuleConfiguration(databaseName, currentRuleConfig);
-            }
+            contextManager.getConfigurationContextManager().alterRuleConfiguration(databaseName, currentRuleConfig);
         }
     }
     
@@ -79,14 +72,7 @@ public final class RuleItemChangedSubscriber {
         RuleConfiguration currentRuleConfig = processor.findRuleConfiguration(contextManager.getMetaDataContexts().getMetaData().getDatabase(databaseName));
         synchronized (this) {
             processor.dropRuleItemConfiguration(event, currentRuleConfig);
-            // TODO Remove isCluster judgment
-            if (contextManager.getInstanceContext().isCluster()) {
-                if (contextManager.getMetaDataContexts().getMetaData().containsDatabase(databaseName)) {
-                    contextManager.getConfigurationContextManager().dropRuleConfiguration(databaseName, currentRuleConfig);
-                }
-            } else {
-                contextManager.getConfigurationContextManager().dropRuleConfiguration(databaseName, currentRuleConfig);
-            }
+            contextManager.getConfigurationContextManager().dropRuleConfiguration(databaseName, currentRuleConfig);
         }
     }
 }