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

[ISSUE#8653]Fix health check bug #8639

Merged
merged 18 commits into from
Jul 26, 2022
Merged

Conversation

hujun-w-2
Copy link
Collaborator

@hujun-w-2 hujun-w-2 commented Jun 27, 2022

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

What is the purpose of the change

for #8653

Brief changelog

1.持久化实例新增change操作
2.在jraft apply操作中校验client是否还存在,如果存在才更新实例

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.

@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2022

Codecov Report

Merging #8639 (9569560) into develop (7aa74b9) will increase coverage by 1.62%.
The diff coverage is 70.83%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #8639      +/-   ##
=============================================
+ Coverage      41.57%   43.20%   +1.62%     
- Complexity      4458     4699     +241     
=============================================
  Files            882      904      +22     
  Lines          32127    32502     +375     
  Branches        3721     3751      +30     
=============================================
+ Hits           13357    14042     +685     
+ Misses         17416    17108     -308     
+ Partials        1354     1352       -2     
Impacted Files Coverage Δ
...ice/impl/PersistentClientOperationServiceImpl.java 55.62% <69.56%> (+2.34%) ⬆️
...thcheck/v2/PersistentHealthStatusSynchronizer.java 100.00% <100.00%> (ø)
...in/java/com/alibaba/nacos/sys/utils/InetUtils.java 31.03% <0.00%> (-24.14%) ⬇️
...ba/nacos/naming/core/v2/client/AbstractClient.java 43.54% <0.00%> (-19.25%) ⬇️
...nacos/common/remote/client/grpc/GrpcSdkClient.java 50.00% <0.00%> (-16.67%) ⬇️
...s/common/remote/client/grpc/GrpcClusterClient.java 50.00% <0.00%> (-16.67%) ⬇️
...aba/nacos/naming/core/v2/index/ServiceStorage.java 51.66% <0.00%> (-15.73%) ⬇️
...ent/manager/impl/EphemeralIpPortClientManager.java 54.00% <0.00%> (-14.00%) ⬇️
...m/alibaba/nacos/core/remote/ConnectionManager.java 37.86% <0.00%> (-7.99%) ⬇️
...ava/com/alibaba/nacos/core/cluster/MemberUtil.java 72.72% <0.00%> (-7.08%) ⬇️
... and 94 more

Continue to review full report at Codecov.

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

@hujun-w-2 hujun-w-2 closed this Jun 28, 2022
@hujun-w-2 hujun-w-2 reopened this Jun 29, 2022
@hujun-w-2 hujun-w-2 changed the title Fix health bug [#ISSUE#8653]Fix health bug Jun 29, 2022
@hujun-w-2 hujun-w-2 changed the title [#ISSUE#8653]Fix health bug [ISSUE#8653]Fix health bug Jun 29, 2022
@hujun-w-2 hujun-w-2 changed the title [ISSUE#8653]Fix health bug [ISSUE#8653]Fix health check bug Jun 29, 2022
@@ -180,6 +208,12 @@ public Response onApply(WriteRequest request) {
}
}

private void onInstanceChange(Service service, Instance instance, String clientId) {
if (clientManager.contains(clientId)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Whether this judgment is accurate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The solution here is that if the instance is logged out, the updated instance will not re register the instance. The logged out "apply" will remove the client, and raft can ensure the order of the logged out "apply" and the updated "apply"

Whether this judgment is accurate?

Copy link
Collaborator

Choose a reason for hiding this comment

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

How about one client register two persistent instance, but only remove one instance?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i will fix it

request.setInstance(instance);
request.setClientId(clientId);
final WriteRequest writeRequest = WriteRequest.newBuilder()
.setGroup(Constants.NAMING_PERSISTENT_SERVICE_GROUP_V2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls use group() instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

@@ -170,6 +195,12 @@ public Response onApply(WriteRequest request) {
case DELETE:
onInstanceDeregister(instanceRequest.service, instanceRequest.getClientId());
break;
case CHANGE:
if (instanceAndServiceExist(instanceRequest)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Discussion: would be better an atomic operation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Discussion: would be better an atomic operation?

The "log" of "jraft" is executed in sequence, and the next log will not be executed before it is executed, so I don't think it's a big problem here.

@KomachiSion
Copy link
Collaborator

coverage of PersistentClientOperationServiceImpl.java reduced

@KomachiSion KomachiSion merged commit e950be1 into alibaba:develop Jul 26, 2022
@KomachiSion KomachiSion added the kind/bug Category issues or prs related to bug. label Jul 26, 2022
@KomachiSion KomachiSion added this to the 2.1.1 milestone Jul 26, 2022
li-xiao-shuang pushed a commit that referenced this pull request Aug 31, 2022
* Add exception detail stacks when connect to server failed.

* [ISSUE#8653]Fix health check bug (#8639)

* fix health bug.

* fix health bug.

* fix health bug.

* test update

* format code

* 注释

* check service exist

* check service exist

* test fail

* user group()

* add unit test.

* add unit test.

* add unit test.

* add unit test.

* add unit test.

* add unit test.

* Add comment for config aspect.

* [ISSUE#8481]Unified TRACE capacity building  (#8805)

* [ISSUE#8481]Unified TRACE capacity building

* [ISSUE#8481]Unified TRACE capacity building
1. Event type add to traceEvent.
2. The event about instance add instancePort.
3. Add health check type to healthChangeEvent.
4. Other fixup.

* Add Generic Type for Simple Cache Map (#8812)

* import config file auth fail (#8844)

* import config file auth fail

* run ci

* run ci2

* Feat/calculate ip count when use batchregister (#8858)

Feat/calculate ip count when use batchregister

* [ISSUE #8880] add a request exception handler (#8881)

* [ISSUE #8880] add a request exception handler

Close #8880

* [ISSUE #8880] retry ci

* Upgrade to 2.1.1 (#8899)

* [ISSUE#8910] bug fix calcu ipCount (#8911)

* bug fix calcu ipCount

* update logic

* judge endpoint (#8933)

* [ISSUE #8925] fix that the value of hasQueryString is always false (#8927)

Close #8925

* [ISSUES#8905]simplify some code (#8908)

* refactor: 💡 update console-ui theme (#8951)

✅ Closes: #8950

* Update IoUtils.java (#8948)

An IOException has been catch,so throws IOException Is invalid

* [ISSUE #8931] Fix bug :BatchInstanceData cannot Serializable question (#8940)

* [fix] fix BatchInstanceData cannot Serializable question

* fix update serialVersionUID auto generate

* [ISSUE #8925] fix that the replaceAll operation is invalid (#8929)

Close #8925

* fix #8947. (#8959)

* judge endpoint

* add some junit test (#8966)

* add some junit test

* fix some junit

* add license

* optimize: internationalization of product description content on landing pages (#8956)

* Improve code specifications. (#8965)

Flip the call to equals method to avoid null pointer exception.

* fix LookupFactoryTest  ut / ci (#8985)

* fix ci

* run ci

* check cla report

* check style

* add some auth plugin test (#8988)

* add some auth plugin test

* ru ci

* remove namespaceShowName uniqueness check (#8989)

* add unit test for ReflectUtils (#8999)

* add unit test for ReflectUtils

* reformat code

* [ISSUE #8993]Close input stream and output stream by try with resource[nacos-common] (#8997)

* [ISSUE #8993]Close input stream and output stream by try with resource[nacos-common]

* [ISSUE #8993]Close input stream and output stream by try with resource[nacos-common]

* [ISSUE #8993]Close input stream and output stream by try with resource[nacos-common]

* add some utils UT (#9006)

add some utils UT

* Fix grpc push data not filter by cluster. (#9019)

* [#344] rename initialization sql files (#8969)

* [ISSUE #9014] performance optimization--refacte TpsMonitorPoint (#9021)

* performance optimization

* fix check style

* fix test unit

* fix test unit for `getTimeFormatOfSecond` method.

* fix unit test  for LimiterTest.

* fix error usage case for asserEquals method;eliminate interactions between test methods

* Fix spelling mistakes. (#9026)

* [ISSUE #9013] enhance grpc client (#9017)

* fix issue #9013

* reformat code style

* reformat code style

* reformat code style

* reformat code style

* reformat code style

* reformat code style

* reformat code style

* change config name

* do some enhance

* add queue size to configProperties

* reformat code style

* Change configuration load order

* Fix ServerListMgr is not shutdown. (#9048)

* set server.error.include-message to ALWAYS (#9045)

* [ISSUE #8934] add header back after convert request to jsonBytes (#8935)

* [ISSUE #9023] fix corner case config dataId 'cipher-' that cannot create (#9024)

* [ISSUE #9023] fix corner case config dataId 'cipher-' that cannot create

* [ISSUE #9023] remove unused import

* [ISSUE #9023] PMD fix

* [ISSUE #9023] add comments

* [ISSUE #9023] should return first token instead of any

* [ISSUE #9023] add more EncryptionHandler ut

* [ISSUE #9023] fix style

* [ISSUE #9023] fix style, keep indentation in blank line

Co-authored-by: KomachiSion <[email protected]>
Co-authored-by: 胡俊 <[email protected]>
Co-authored-by: MajorHe1 <[email protected]>
Co-authored-by: GuiShao <[email protected]>
Co-authored-by: ZhangShenao <[email protected]>
Co-authored-by: chenhao26 <[email protected]>
Co-authored-by: onewe <[email protected]>
Co-authored-by: 胡俊 <[email protected]>
Co-authored-by: liushaoyu-soft <[email protected]>
Co-authored-by: heimanba <[email protected]>
Co-authored-by: 无处不在 <[email protected]>
Co-authored-by: Weizhan Yun <[email protected]>
Co-authored-by: liaochuntao <[email protected]>
Co-authored-by: @xiaochangbai <[email protected]>
Co-authored-by: shiherua <[email protected]>
Co-authored-by: Karson <[email protected]>
Co-authored-by: yjqg6666 <[email protected]>
Co-authored-by: 阿魁 <[email protected]>
Co-authored-by: wuwen <[email protected]>
Co-authored-by: hutt <[email protected]>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants