You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "funky-eyes (via GitHub)" <gi...@apache.org> on 2025/03/19 09:02:30 UTC
[PR] optimize: discover the raft leader node from the naming server [incubator-seata]
funky-eyes opened a new pull request, #7234:
URL: https://github.com/apache/incubator-seata/pull/7234
<!-- Please make sure you have read and understood the contributing guidelines -->
- [ ] I have registered the PR [changes](../changes).
### Ⅰ. Describe what this PR did
When a raft re-election occurs, there may be two leaders on the naming server side: the old leader that unexpectedly went down (since the heartbeat has not yet expired, it has not been removed) and the newly elected leader. It is necessary to filter out the latest leader based on the term to ensure the client correctly connects to the leader node.
当raft发生重选举时,namingserver侧可能存在两个leader,一个是意外宕机的老leader(由于心跳还未到期,所以还没被摘除),一个是新选举的leader,需要根据term去筛选出最新leader,以便client正确连接到leader节点
### Ⅱ. Does this pull request fix one issue?
<!-- If that, add "fixes #xxx" below in the next line, for example, fixes #97. -->
### Ⅲ. Why don't you add test cases (unit test/integration test)?
### Ⅳ. Describe how to verify it
### Ⅴ. Special notes for reviews
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: discover the raft leader node from the naming server [incubator-seata]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #7234:
URL: https://github.com/apache/incubator-seata/pull/7234#issuecomment-2735847146
## [Codecov](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `0%` with `33 lines` in your changes missing coverage. Please review.
> Project coverage is 53.74%. Comparing base [(`9c57b2e`)](https://app.codecov.io/gh/apache/incubator-seata/commit/9c57b2eeddf3cbabb865f0f78ce4056b23b1590a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`bee8821`)](https://app.codecov.io/gh/apache/incubator-seata/commit/bee8821fe956d3ea69232d9c297f1bda417b2eb4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 1 commits behind head on 2.x.
| [Files with missing lines](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [.../namingserver/NamingserverRegistryServiceImpl.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&filepath=discovery%2Fseata-discovery-namingserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Fdiscovery%2Fregistry%2Fnamingserver%2FNamingserverRegistryServiceImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGlzY292ZXJ5L3NlYXRhLWRpc2NvdmVyeS1uYW1pbmdzZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NlYXRhL2Rpc2NvdmVyeS9yZWdpc3RyeS9uYW1pbmdzZXJ2ZXIvTmFtaW5nc2VydmVyUmVnaXN0cnlTZXJ2aWNlSW1wbC5qYXZh) | 0.00% | [21 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...orage/raft/sore/RaftVGroupMappingStoreManager.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&filepath=server%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Fserver%2Fstorage%2Fraft%2Fsore%2FRaftVGroupMappingStoreManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9zZXJ2ZXIvc3RvcmFnZS9yYWZ0L3NvcmUvUmFmdFZHcm91cE1hcHBpbmdTdG9yZU1hbmFnZXIuamF2YQ==) | 0.00% | [8 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ta/server/instance/RaftServerInstanceStrategy.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&filepath=server%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Fserver%2Finstance%2FRaftServerInstanceStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9zZXJ2ZXIvaW5zdGFuY2UvUmFmdFNlcnZlckluc3RhbmNlU3RyYXRlZ3kuamF2YQ==) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 2.x #7234 +/- ##
============================================
- Coverage 53.80% 53.74% -0.06%
- Complexity 7151 7173 +22
============================================
Files 1171 1173 +2
Lines 41626 41788 +162
Branches 4877 4905 +28
============================================
+ Hits 22397 22461 +64
- Misses 17114 17205 +91
- Partials 2115 2122 +7
```
| [Files with missing lines](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...ta/server/instance/RaftServerInstanceStrategy.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&filepath=server%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Fserver%2Finstance%2FRaftServerInstanceStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9zZXJ2ZXIvaW5zdGFuY2UvUmFmdFNlcnZlckluc3RhbmNlU3RyYXRlZ3kuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...orage/raft/sore/RaftVGroupMappingStoreManager.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&filepath=server%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Fserver%2Fstorage%2Fraft%2Fsore%2FRaftVGroupMappingStoreManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zZWF0YS9zZXJ2ZXIvc3RvcmFnZS9yYWZ0L3NvcmUvUmFmdFZHcm91cE1hcHBpbmdTdG9yZU1hbmFnZXIuamF2YQ==) | `3.38% <0.00%> (+0.05%)` | :arrow_up: |
| [.../namingserver/NamingserverRegistryServiceImpl.java](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&filepath=discovery%2Fseata-discovery-namingserver%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fseata%2Fdiscovery%2Fregistry%2Fnamingserver%2FNamingserverRegistryServiceImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGlzY292ZXJ5L3NlYXRhLWRpc2NvdmVyeS1uYW1pbmdzZXJ2ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NlYXRhL2Rpc2NvdmVyeS9yZWdpc3RyeS9uYW1pbmdzZXJ2ZXIvTmFtaW5nc2VydmVyUmVnaXN0cnlTZXJ2aWNlSW1wbC5qYXZh) | `0.00% <0.00%> (ø)` | |
... and [7 files with indirect coverage changes](https://app.codecov.io/gh/apache/incubator-seata/pull/7234/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
[](https://app.codecov.io/gh/apache/incubator-seata/pull/7234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary>🚀 New features to boost your workflow: </summary>
- ❄ [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- 📦 [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: discover the raft leader node from the naming server [incubator-seata]
Posted by "xjlgod (via GitHub)" <gi...@apache.org>.
xjlgod commented on code in PR #7234:
URL: https://github.com/apache/incubator-seata/pull/7234#discussion_r2005889033
##########
discovery/seata-discovery-namingserver/src/test/java/org/apache/seata/discovery/registry/namingserver/NamingserverRegistryServiceImplTest.java:
##########
@@ -157,6 +203,7 @@ public void testRegister2() throws Exception {
@Test
+ @Disabled
Review Comment:
why there are some many unit test disabled?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: discover the raft leader node from the naming server [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7234:
URL: https://github.com/apache/incubator-seata/pull/7234#discussion_r2006696808
##########
discovery/seata-discovery-namingserver/src/test/java/org/apache/seata/discovery/registry/namingserver/NamingserverRegistryServiceImplTest.java:
##########
@@ -157,6 +203,7 @@ public void testRegister2() throws Exception {
@Test
+ @Disabled
Review Comment:
Because these test cases need to be coordinated with the namingserver node, they can only be used for local testing. The test cases in this test class were all initially disabled. I have modified and enabled some of them to run in GitHub CI.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] optimize: discover the raft leader node from the naming server [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes merged PR #7234:
URL: https://github.com/apache/incubator-seata/pull/7234
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org