You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by ji...@apache.org on 2025/02/25 01:36:48 UTC

(incubator-seata) branch 2.x updated: optimize: use the ip of the peerId as the host of the raft node (#7182)

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

jianbin pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 4c7d1d9dd0 optimize:  use the ip of the peerId as the host of the raft node (#7182)
4c7d1d9dd0 is described below

commit 4c7d1d9dd0b3f59dbe37685ef3109547184082ec
Author: PeppaO <39...@users.noreply.github.com>
AuthorDate: Tue Feb 25 09:36:44 2025 +0800

    optimize:  use the ip of the peerId as the host of the raft node (#7182)
---
 changes/en-us/2.x.md                                                  | 1 +
 changes/zh-cn/2.x.md                                                  | 1 +
 .../java/org/apache/seata/server/cluster/raft/RaftStateMachine.java   | 4 ++--
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 60b4bb2e1b..2f363f0292 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -13,6 +13,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#7114](https://github.com/apache/incubator-seata/pull/7114)] support raft mode registry to namingserver
 - [[#7133](https://github.com/apache/incubator-seata/pull/7133)] Implement scheduled handling for end status transaction
 - [[#7171](https://github.com/apache/incubator-seata/pull/7171)] support EpollEventLoopGroup in client
+- [[#7182](https://github.com/apache/incubator-seata/pull/7182)] use the ip of the peerId as the host of the raft node
 - [[#7181](https://github.com/apache/incubator-seata/pull/7181)] raft implements domain name resolution and selects peerId
 
 
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 2193601286..29fed04339 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -13,6 +13,7 @@
 - [[#7114](https://github.com/apache/incubator-seata/pull/7114)] 支持raft集群注册至namingserver
 - [[#7133](https://github.com/apache/incubator-seata/pull/7133)] 实现对残留的end状态事务定时处理
 - [[#7171](https://github.com/apache/incubator-seata/pull/7171)] 客户端支持 EpollEventLoopGroup
+- [[#7182](https://github.com/apache/incubator-seata/pull/7182)] 采用peerId的ip作为raft节点的host
 - [[#7181](https://github.com/apache/incubator-seata/pull/7181)] raft实现域名解析并选择peerId
 
 
diff --git a/server/src/main/java/org/apache/seata/server/cluster/raft/RaftStateMachine.java b/server/src/main/java/org/apache/seata/server/cluster/raft/RaftStateMachine.java
index 89f85e9b29..10d18e9f31 100644
--- a/server/src/main/java/org/apache/seata/server/cluster/raft/RaftStateMachine.java
+++ b/server/src/main/java/org/apache/seata/server/cluster/raft/RaftStateMachine.java
@@ -370,7 +370,7 @@ public class RaftStateMachine extends StateMachineAdapter {
         if (leaderNode == null || (leaderNode.getInternal() != null
             && !cureentPeerId.equals(new PeerId(leaderNode.getInternal().getHost(), leaderNode.getInternal().getPort())))) {
             Node leader =
-                raftClusterMetadata.createNode(XID.getIpAddress(), XID.getPort(), raftServer.getServerId().getPort(),
+                raftClusterMetadata.createNode(cureentPeerId.getIp(), XID.getPort(), raftServer.getServerId().getPort(),
                     Integer.parseInt(
                         ((Environment)ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT))
                             .getProperty("server.port", String.valueOf(7091))),
@@ -413,7 +413,7 @@ public class RaftStateMachine extends StateMachineAdapter {
             if (leader != null && StringUtils.isNotBlank(leader.getVersion())) {
                 RaftServer raftServer = RaftServerManager.getRaftServer(group);
                 PeerId cureentPeerId = raftServer.getServerId();
-                Node node = raftClusterMetadata.createNode(XID.getIpAddress(), XID.getPort(), cureentPeerId.getPort(),
+                Node node = raftClusterMetadata.createNode(cureentPeerId.getIp(), XID.getPort(), cureentPeerId.getPort(),
                     Integer.parseInt(
                         ((Environment)ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT))
                             .getProperty("server.port", String.valueOf(7091))),


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org