Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support raft mode registry to namingserver #7114

Merged
merged 22 commits into from
Feb 24, 2025

Conversation

funky-eyes
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 17.91667% with 197 lines in your changes missing coverage. Please review.

Project coverage is 52.18%. Comparing base (c4b9b93) to head (8ca4731).
Report is 2 commits behind head on 2.x.

Files with missing lines Patch % Lines
...orage/raft/sore/RaftVGroupMappingStoreManager.java 3.33% 58 Missing ⚠️
...ta/server/instance/RaftServerInstanceStrategy.java 0.00% 32 Missing ⚠️
...uster/raft/snapshot/vgroup/VGroupSnapshotFile.java 0.00% 29 Missing ⚠️
...server/instance/AbstractSeataInstanceStrategy.java 27.27% 15 Missing and 1 partial ⚠️
...ava/org/apache/seata/common/metadata/Instance.java 7.14% 13 Missing ⚠️
...erver/cluster/raft/sync/msg/RaftVGroupSyncMsg.java 0.00% 9 Missing ⚠️
...rg/apache/seata/server/filter/RaftGroupFilter.java 10.00% 9 Missing ⚠️
...ache/seata/namingserver/manager/NamingManager.java 46.66% 5 Missing and 3 partials ⚠️
...eata/namingserver/controller/NamingController.java 0.00% 7 Missing ⚠️
.../cluster/raft/execute/vgroup/VGroupAddExecute.java 25.00% 3 Missing ⚠️
... and 6 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##                2.x    #7114    +/-   ##
==========================================
  Coverage     52.17%   52.18%            
- Complexity     6817     6850    +33     
==========================================
  Files          1154     1165    +11     
  Lines         41116    41317   +201     
  Branches       4820     4835    +15     
==========================================
+ Hits          21454    21562   +108     
- Misses        17624    17703    +79     
- Partials       2038     2052    +14     
Files with missing lines Coverage Δ
...in/java/org/apache/seata/common/metadata/Node.java 40.00% <100.00%> (ø)
...common/metadata/namingserver/NamingServerNode.java 91.66% <ø> (-0.65%) ⬇️
...ache/seata/namingserver/entity/bo/NamespaceBO.java 59.09% <ø> (ø)
...ot/autoconfigure/loader/SeataPropertiesLoader.java 63.15% <ø> (ø)
...e/properties/server/raft/ServerRaftProperties.java 100.00% <100.00%> (ø)
...ata/server/cluster/raft/snapshot/RaftSnapshot.java 75.00% <ø> (ø)
.../src/main/java/org/apache/seata/server/Server.java 71.87% <100.00%> (ø)
...he/seata/server/cluster/raft/RaftStateMachine.java 44.58% <100.00%> (+32.36%) ⬆️
...r/cluster/raft/execute/AbstractRaftMsgExecute.java 100.00% <100.00%> (ø)
...ata/server/cluster/raft/snapshot/RaftSnapshot.java 82.75% <100.00%> (+0.61%) ⬆️
... and 23 more

... and 9 files with indirect coverage changes

@funky-eyes funky-eyes changed the title [WIP]feature: support raft mode registry to namingserver feature: support raft mode registry to namingserver Jan 16, 2025
@funky-eyes funky-eyes requested a review from ggbocoder January 16, 2025 13:34
@ggbocoder
Copy link
Contributor

please add signature

@xingfudeshi xingfudeshi self-requested a review February 17, 2025 07:16
Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -156,6 +156,9 @@ public void register(Instance instance) throws Exception {
doRegister(instance, getNamingAddrs());
}

public void doRegister(List<Instance> instance, List<String> urlList) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this method is not implemented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a reserved interface because, when multi-raft is implemented, a node will have multiple instances.

@@ -152,7 +154,9 @@ public Result<String> createGroup(String namespace, String vGroup, String cluste
LOGGER.error("no instance in cluster {}", clusterName);
return new Result<>("301", "no instance in cluster" + clusterName);
} else {
Node node = nodeList.get(0);
Node node =
nodeList.stream().filter(n -> n.getRole() == ClusterRole.LEADER || n.getRole() == ClusterRole.MEMBER)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why leader and memeber can be selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a Raft cluster, you need to find the leader to create the group, whereas for a regular cluster, you need to find a member to create the group.

@xjlgod
Copy link
Contributor

xjlgod commented Feb 17, 2025

Maybe we can add some example to show how to config raft mode of namingserver?

@funky-eyes
Copy link
Contributor Author

Maybe we can add some example to show how to config raft mode of namingserver?

Integration testing is required, but the Seata repository currently does not support it. However, you can compile the code locally and test it using a combination of client, server, and naming server.

@slievrly slievrly self-assigned this Feb 18, 2025
@funky-eyes funky-eyes merged commit 3c050a2 into apache:2.x Feb 24, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants