bugfix: use service port for naming server control metadata#8128
Open
skt-shinyruo wants to merge 7 commits into
Open
bugfix: use service port for naming server control metadata#8128skt-shinyruo wants to merge 7 commits into
skt-shinyruo wants to merge 7 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes how Seata server instances publish their control endpoint port to the naming server by using the Seata service port (XID.getPort()) instead of Spring’s server.port, preventing naming server request forwarding to a non-listening port (Fixes #8110).
Changes:
- Switch control endpoint port selection to
XID.getPort()in both General and Raft instance strategies. - Align Raft leader metadata publishing and current-node metadata sync to publish the service port for
control. - Add/adjust regression tests to validate the control port behavior and restore shared singleton/environment state between tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/main/java/org/apache/seata/server/instance/GeneralInstanceStrategy.java | Publish control endpoint using XID.getPort() instead of server.port. |
| server/src/main/java/org/apache/seata/server/instance/RaftServerInstanceStrategy.java | Publish control endpoint using XID.getPort() instead of server.port. |
| server/src/main/java/org/apache/seata/server/cluster/raft/RaftStateMachine.java | Use service port for control metadata in leader metadata and current-node sync paths. |
| server/src/test/java/org/apache/seata/server/instance/GeneralInstanceStrategyTest.java | New regression test ensuring control endpoint uses service port; restores shared state. |
| server/src/test/java/org/apache/seata/server/instance/RaftServerInstanceStrategyTest.java | Update regression to assert control endpoint uses service port; restores shared state. |
| server/src/test/java/org/apache/seata/server/cluster/raft/RaftStateMachineTest.java | Add regression tests validating metadata uses service port for control; cleans up RouteTable and environment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
XID.getPort()instead ofserver.portwhen registering naming server control metadata in the general and raft instance strategiesRaftStateMachinemetadata sync paths so leader metadata and current node sync both publish the service port forcontrolFixes #8110.
Test Plan
./mvnw -pl server -DskipITs -Dtest=GeneralInstanceStrategyTest,RaftServerInstanceStrategyTest,RaftStateMachineTest test