You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by to...@apache.org on 2022/06/17 12:24:07 UTC

[shardingsphere] branch master updated: fix duplicate xa_recovery_id after instance online (#18415)

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

totalo 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 41095af2c39 fix duplicate xa_recovery_id after instance online (#18415)
41095af2c39 is described below

commit 41095af2c39f4553840f27a47f387408e54389cd
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Fri Jun 17 20:24:01 2022 +0800

    fix duplicate xa_recovery_id after instance online (#18415)
---
 .../java/org/apache/shardingsphere/infra/instance/InstanceContext.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
index 3154f31f73f..56eeb602ab7 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
@@ -114,7 +114,8 @@ public final class InstanceContext {
             computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId)).forEach(each -> each.getXaRecoveryIds().add(xaRecoveryId));
             return true;
         }
-        computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId)).forEach(each -> each.getXaRecoveryIds().add(xaRecoveryId));
+        computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId) && !each.getXaRecoveryIds().contains(xaRecoveryId))
+                .forEach(each -> each.getXaRecoveryIds().add(xaRecoveryId));
         return false;
     }