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 2024/08/08 10:02:32 UTC

(shardingsphere) branch master updated: Refactor RuleConfigurationPersistDecorateEngine (#32428)

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 41e555e3c66 Refactor RuleConfigurationPersistDecorateEngine (#32428)
41e555e3c66 is described below

commit 41e555e3c6626e93fe248bbf9cbe2f35d51622be
Author: Raigor <ra...@gmail.com>
AuthorDate: Thu Aug 8 18:02:25 2024 +0800

    Refactor RuleConfigurationPersistDecorateEngine (#32428)
---
 .../apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java    | 2 +-
 .../mode/metadata/decorator/RuleConfigurationPersistDecorateEngine.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
index 215599b6708..50e69e095e5 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContextsFactory.java
@@ -212,7 +212,7 @@ public final class MetaDataContextsFactory {
     private static void persistDatabaseConfigurations(final MetaDataContexts metadataContexts, final ContextManagerBuilderParameter param, final MetaDataPersistService persistService,
                                                       final ComputeNodeInstanceContext computeNodeInstanceContext) {
         RuleConfigurationPersistDecorateEngine ruleConfigPersistDecorateEngine = new RuleConfigurationPersistDecorateEngine(computeNodeInstanceContext);
-        persistService.persistGlobalRuleConfiguration(ruleConfigPersistDecorateEngine.decorate(param.getGlobalRuleConfigs()), param.getProps());
+        persistService.persistGlobalRuleConfiguration(ruleConfigPersistDecorateEngine.decorate(metadataContexts.getMetaData().getGlobalRuleMetaData().getConfigurations()), param.getProps());
         for (Entry<String, ? extends DatabaseConfiguration> entry : param.getDatabaseConfigs().entrySet()) {
             String databaseName = entry.getKey();
             persistService.persistConfigurations(entry.getKey(), entry.getValue(),
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/decorator/RuleConfigurationPersistDecorateEngine.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/decorator/RuleConfigurationPersistDecorateEngine.java
index bb7dea44a60..f197fd4043a 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/decorator/RuleConfigurationPersistDecorateEngine.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/decorator/RuleConfigurationPersistDecorateEngine.java
@@ -61,7 +61,7 @@ public final class RuleConfigurationPersistDecorateEngine {
             return ruleConfigs;
         }
         return ruleConfigs.stream()
-                .map(each -> TypedSPILoader.findService(RuleConfigurationPersistDecorator.class, each).map(optional -> optional.restore(each)).orElse(each)).collect(Collectors.toList());
+                .map(each -> TypedSPILoader.findService(RuleConfigurationPersistDecorator.class, each.getClass()).map(optional -> optional.restore(each)).orElse(each)).collect(Collectors.toList());
     }
     
     /**