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 cbc5b2db3f8 Fix alter transaction rule by new cluster (#26619)
cbc5b2db3f8 is described below

commit cbc5b2db3f8a4e5a44afba6065c80b00a5ebfb4a
Author: ZhangCheng <[email protected]>
AuthorDate: Tue Jun 27 16:21:05 2023 +0800

    Fix alter transaction rule by new cluster (#26619)
---
 .../yaml/swapper/NewYamlTransactionRuleConfigurationSwapper.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/NewYamlTransactionRuleConfigurationSwapper.java
 
b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/NewYamlTransactionRuleConfigurationSwapper.java
index 445a8012e9a..b2b6e2935f4 100644
--- 
a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/NewYamlTransactionRuleConfigurationSwapper.java
+++ 
b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/NewYamlTransactionRuleConfigurationSwapper.java
@@ -57,10 +57,14 @@ public final class 
NewYamlTransactionRuleConfigurationSwapper implements NewYaml
             if (!version.isPresent()) {
                 continue;
             }
-            return YamlEngine.unmarshal(each.getValue(), 
TransactionRuleConfiguration.class);
+            return swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlTransactionRuleConfiguration.class));
         }
         return new TransactionRuleConfiguration(TransactionType.LOCAL.name(), 
null, new Properties());
     }
+
+    private TransactionRuleConfiguration swapToObject(final 
YamlTransactionRuleConfiguration yamlConfig) {
+        return new TransactionRuleConfiguration(yamlConfig.getDefaultType(), 
yamlConfig.getProviderType(), null == yamlConfig.getProps() ? new Properties() 
: yamlConfig.getProps());
+    }
     
     @Override
     public Class<TransactionRuleConfiguration> getTypeClass() {

Reply via email to