You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2023/06/27 15:26:08 UTC

[shardingsphere] branch master updated: Refactor NewClusterModeContextManager.alterRuleConfiguration (#26642)

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 8794a8f7ea1 Refactor NewClusterModeContextManager.alterRuleConfiguration (#26642)
8794a8f7ea1 is described below

commit 8794a8f7ea105967279871f95fd80f01cb248990
Author: zhaojinchao <zh...@apache.org>
AuthorDate: Tue Jun 27 23:26:01 2023 +0800

    Refactor NewClusterModeContextManager.alterRuleConfiguration (#26642)
---
 .../mode/manager/cluster/NewClusterModeContextManager.java              | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/NewClusterModeContextManager.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/NewClusterModeContextManager.java
index b2aa381a581..79151930a69 100644
--- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/NewClusterModeContextManager.java
+++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/NewClusterModeContextManager.java
@@ -33,6 +33,7 @@ import org.apache.shardingsphere.metadata.persist.service.database.DatabaseMetaD
 import org.apache.shardingsphere.metadata.persist.service.version.MetaDataVersionBasedPersistService;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.manager.ContextManagerAware;
+import org.apache.shardingsphere.single.api.config.SingleRuleConfiguration;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -124,6 +125,7 @@ public final class NewClusterModeContextManager implements ModeContextManager, C
     
     @Override
     public void alterRuleConfiguration(final String databaseName, final Collection<RuleConfiguration> ruleConfigs) {
+        ruleConfigs.removeIf(each -> !each.getClass().isAssignableFrom(SingleRuleConfiguration.class));
         contextManager.getMetaDataContexts().getPersistService().getDatabaseRulePersistService().persist(databaseName, ruleConfigs);
     }