nacos icon indicating copy to clipboard operation
nacos copied to clipboard

Optimize checkLocalConfig logic

Open PleaseGiveMeTheCoke opened this issue 11 months ago • 11 comments

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

What is the purpose of the change

issue:https://github.com/alibaba/nacos/issues/11866

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.

PleaseGiveMeTheCoke avatar Mar 25 '24 05:03 PleaseGiveMeTheCoke

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 25 '24 05:03 CLAassistant

LGTM

stone-98 avatar Mar 25 '24 08:03 stone-98

Please sign CLA first.

KomachiSion avatar Mar 25 '24 09:03 KomachiSion

Please sign CLA first.

done

PleaseGiveMeTheCoke avatar Mar 26 '24 01:03 PleaseGiveMeTheCoke

The PR title may need to be updated to English.

dongm2ez avatar Mar 27 '24 02:03 dongm2ez

fix checkstyle pls.

shiyiyue1102 avatar Apr 01 '24 07:04 shiyiyue1102

我重新读了一下逻辑, 这个重构后的逻辑颠覆了之前的设计理念。

之前之所以不使用变量,是为了在获取failover后, 再次进行文件存在的校验,换句话说进行了至少2次的文件存在校验。

而重构后的逻辑,只进行了一次校验,同时时间上也不太正确。

原: 是否存在 -》 存在读取 -〉 再次校验-》存在则使用,不存在则不使用。 新: 是否存在 -〉 是否删除 -> 存在读取 -> 删除则不使用。

这可能导致某些极端情况下和之前的客户端会有不同的行为, 我的建议是把校验逻辑和通用逻辑抽象成方法, 而不是只用变量存储,并且不建议修改顺序。

好的,考虑的好细致,感谢提醒

PleaseGiveMeTheCoke avatar Apr 02 '24 05:04 PleaseGiveMeTheCoke

@KomachiSion 请问这个pr合并之前还有什么我需要改动的吗

PleaseGiveMeTheCoke avatar Apr 26 '24 11:04 PleaseGiveMeTheCoke

CICD通过的话就可以合并了

KomachiSion avatar Apr 29 '24 02:04 KomachiSion

CICD通过的话就可以合并了

现在应该通过了?

PleaseGiveMeTheCoke avatar Apr 29 '24 12:04 PleaseGiveMeTheCoke

CICD通过的话就可以合并了

hi,麻烦帮忙合并一下? @KomachiSion

PleaseGiveMeTheCoke avatar May 31 '24 12:05 PleaseGiveMeTheCoke