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

[shardingsphere] branch master updated: Fix new database rule subscriber (#26372)

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

zhaojinchao 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 c4ee4883b1b Fix new database rule subscriber (#26372)
c4ee4883b1b is described below

commit c4ee4883b1bb287731b4f6ecceeb629fe0df8598
Author: ChenJiaHao <Pa...@163.com>
AuthorDate: Thu Jun 15 19:03:15 2023 +0800

    Fix new database rule subscriber (#26372)
---
 .../encrypt/subscriber/EncryptConfigurationSubscriber.java               | 1 -
 .../coordinator/subscriber/NewConfigurationChangedSubscriber.java        | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptConfigurationSubscriber.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptConfigurationSubscriber.java
index 4527b1e481e..fbd288e0790 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptConfigurationSubscriber.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/subscriber/EncryptConfigurationSubscriber.java
@@ -65,7 +65,6 @@ public final class EncryptConfigurationSubscriber implements RuleConfigurationSu
         EncryptRuleConfiguration config;
         if (rule.isPresent()) {
             config = (EncryptRuleConfiguration) rule.get().getConfiguration();
-            config.getTables().removeIf(each -> each.getName().equals(needToAddedConfig.getName()));
             config.getTables().add(needToAddedConfig);
         } else {
             config = new EncryptRuleConfiguration(Collections.singletonList(needToAddedConfig), Collections.emptyMap());
diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/NewConfigurationChangedSubscriber.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/NewConfigurationChangedSubscriber.java
index 5d062591a17..0c02d27d830 100644
--- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/NewConfigurationChangedSubscriber.java
+++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/NewConfigurationChangedSubscriber.java
@@ -57,6 +57,7 @@ public final class NewConfigurationChangedSubscriber {
         Collection<ShardingSphereRule> rules = new LinkedList<>(database.getRuleMetaData().getRules());
         rules.addAll(DatabaseRulesBuilder.build(databaseName, database.getResourceMetaData().getDataSources(), database.getRuleMetaData().getRules(),
                 event.getRuleConfig(), contextManager.getInstanceContext()));
+        database.getRuleMetaData().getRules().clear();
         database.getRuleMetaData().getRules().addAll(rules);
     }