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

[Refactor&Enhancement] Enhance naming server status check. #12573

Merged

Conversation

KomachiSion
Copy link
Collaborator

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

Fixes #12526, check whether cp protocol has init before getting to avoid async get dead lock.

For #12504,#12541,#12558 Enhance naming server stauts check logic, which can downgrade the check to avoid affect core features.

But if no leader for raft group, the relative features still can't be used.

Brief changelog

XX

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

@KomachiSion KomachiSion added kind/enhancement Category issues or prs related to enhancement. kind/bug Category issues or prs related to bug. kind/refactor labels Sep 2, 2024
@KomachiSion KomachiSion added this to the 2.4.2 milestone Sep 2, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2024

Codecov Report

Attention: Patch coverage is 74.07407% with 7 lines in your changes missing coverage. Please review.

Project coverage is 69.63%. Comparing base (209dfe8) to head (8171c90).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
.../alibaba/nacos/naming/web/TrafficReviseFilter.java 0.00% 3 Missing ⚠️
...libaba/nacos/core/distributed/ProtocolManager.java 0.00% 2 Missing ⚠️
...baba/nacos/naming/cluster/ServerStatusManager.java 83.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop   #12573   +/-   ##
==========================================
  Coverage      69.63%   69.63%           
- Complexity      9399     9408    +9     
==========================================
  Files           1275     1275           
  Lines          41161    41180   +19     
  Branches        4366     4370    +4     
==========================================
+ Hits           28663    28677   +14     
- Misses         10422    10425    +3     
- Partials        2076     2078    +2     
Files with missing lines Coverage Δ
...aba/nacos/core/distributed/raft/JRaftProtocol.java 35.00% <100.00%> (+1.10%) ⬆️
...ibaba/nacos/core/distributed/raft/JRaftServer.java 61.47% <100.00%> (+0.92%) ⬆️
...libaba/nacos/core/distributed/raft/RaftConfig.java 53.84% <100.00%> (+6.02%) ⬆️
...libaba/nacos/core/distributed/ProtocolManager.java 10.60% <0.00%> (-0.34%) ⬇️
...baba/nacos/naming/cluster/ServerStatusManager.java 93.33% <83.33%> (-6.67%) ⬇️
.../alibaba/nacos/naming/web/TrafficReviseFilter.java 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 209dfe8...8171c90. Read the comment docs.

@XiaZhouxx
Copy link
Contributor

@KomachiSion 大佬这个死锁问题我想请教一下, 我看原因好像是Spring加载阶段多线程调用ProtocolManager.getCpProtocol(), getCpProtocol()是暴露出去可以直接使用的方法(我看大部分引用处都是直接调用), 这里我理解的是不是还可以在构造函数时就提前初始化规避掉可能使用不当导致的死锁?

@KomachiSion
Copy link
Collaborator Author

@KomachiSion 大佬这个死锁问题我想请教一下, 我看原因好像是Spring加载阶段多线程调用ProtocolManager.getCpProtocol(), getCpProtocol()是暴露出去可以直接使用的方法(我看大部分引用处都是直接调用), 这里我理解的是不是还可以在构造函数时就提前初始化规避掉可能使用不当导致的死锁?

有一些地方不是spring bean,不能直接在初始化的时候依赖。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Category issues or prs related to bug. kind/enhancement Category issues or prs related to enhancement. kind/refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nacos2.4.1较大概率不进行raft选主
3 participants