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 #12872]Refactor ConfigCache and related pathways ,uniformly use UTF-8 encoding for md5 fields #12931

Merged
merged 12 commits into from
Dec 9, 2024

Conversation

Sunrisea
Copy link
Contributor

@Sunrisea Sunrisea commented Dec 9, 2024

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

What is the purpose of the change

Refactor ConfigCache and related pathways ,uniformly use UTF-8 encoding for md5 fields. Utilize the SPI mechanism in related pathways and methods to ensure extensibility for support of other types of encoding. Fix test.

Brief changelog

Create the ConfigCacheFactory interface to handle the creation of ConfigCache instances.
Create the Md5PostProcessor interface to handle the md5 dump of ConfigCache.
Create the Md5Comparator interface.
Utilize the SPI (Service Provider Interface) mechanism in related pathways and methods to ensure extensibility for support of other types of encoding, and implement the default handling methods for UTF-8 encoded md5 values.

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.

Copy link

github-actions bot commented Dec 9, 2024

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 82.94574% with 22 lines in your changes missing coverage. Please review.

Project coverage is 72.32%. Comparing base (cb3685d) to head (5ab9cc3).

Files with missing lines Patch % Lines
...alibaba/nacos/config/server/model/ConfigCache.java 37.50% 5 Missing ⚠️
...onfig/server/model/ConfigCacheFactoryDelegate.java 84.37% 3 Missing and 2 partials ⚠️
...server/model/ConfigCachePostProcessorDelegate.java 79.16% 3 Missing and 2 partials ⚠️
...cos/config/server/utils/Md5ComparatorDelegate.java 78.26% 3 Missing and 2 partials ⚠️
...acos/config/server/service/ConfigCacheService.java 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop   #12931      +/-   ##
=============================================
+ Coverage      72.29%   72.32%   +0.03%     
- Complexity      9930     9958      +28     
=============================================
  Files           1302     1308       +6     
  Lines          41751    41830      +79     
  Branches        4392     4403      +11     
=============================================
+ Hits           30182    30252      +70     
- Misses          9461     9462       +1     
- Partials        2108     2116       +8     
Files with missing lines Coverage Δ
...server/configuration/NacosConfigConfiguration.java 0.00% <ø> (ø)
...m/alibaba/nacos/config/server/model/CacheItem.java 84.21% <100.00%> (ø)
...aba/nacos/config/server/model/ConfigCacheGray.java 55.55% <100.00%> (+10.10%) ⬆️
...s/config/server/model/NacosConfigCacheFactory.java 100.00% <100.00%> (ø)
...ig/server/model/NacosConfigCachePostProcessor.java 100.00% <100.00%> (ø)
...ig/server/service/query/handler/FormalHandler.java 94.73% <100.00%> (ø)
...er/service/query/handler/GrayRuleMatchHandler.java 92.59% <100.00%> (ø)
...rvice/query/handler/SpecialTagNotFoundHandler.java 95.23% <100.00%> (ø)
...com/alibaba/nacos/config/server/utils/MD5Util.java 80.30% <100.00%> (-2.60%) ⬇️
.../nacos/config/server/utils/NacosMd5Comparator.java 100.00% <100.00%> (ø)
... and 5 more

... and 3 files 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 cb3685d...5ab9cc3. Read the comment docs.

@wuyfee
Copy link

wuyfee commented Dec 9, 2024

$\color{green}{SUCCESS}$
DETAILS
✅ - docker: success
✅ - deploy (standalone & cluster & standalone_auth): success
✅ - e2e-java-test (standalone & cluster & standalone_auth): success
✅ - e2e-go-test (standalone & cluster): success
✅ - e2e-cpp-test (standalone & cluster): success
✅ - e2e-csharp-test (standalone & cluster): success
✅ - e2e-nodejs-test (standalone & cluster): success
✅ - e2e-python-test (standalone & cluster): success
✅ - clean (standalone & cluster & standalone_auth): success

*
* @return the config cache factory name
*/
public String getConfigCacheFactoryName();
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to getName

*
* @return the md 5 comparator name
*/
public String getMd5ComparatorName();
Copy link
Collaborator

Choose a reason for hiding this comment

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

change to getName

@wuyfee
Copy link

wuyfee commented Dec 9, 2024

$\color{green}{SUCCESS}$
DETAILS
✅ - docker: success
✅ - deploy (standalone & cluster & standalone_auth): success
✅ - e2e-java-test (standalone & cluster & standalone_auth): success
✅ - e2e-go-test (standalone & cluster): success
✅ - e2e-cpp-test (standalone & cluster): success
✅ - e2e-csharp-test (standalone & cluster): success
✅ - e2e-nodejs-test (standalone & cluster): success
✅ - e2e-python-test (standalone & cluster): success
✅ - clean (standalone & cluster & standalone_auth): success

@shiyiyue1102 shiyiyue1102 merged commit 08fac16 into alibaba:develop Dec 9, 2024
7 checks passed
YunWZ pushed a commit to YunWZ/nacos that referenced this pull request Dec 13, 2024
…rmly use UTF-8 encoding for md5 fields (alibaba#12931)

* Refactor ConfigCache and related pathways optimize encoding for md5 fields. Utilize the SPI mechanism in related pathways and methods to ensure extensibility for config cache
@KomachiSion KomachiSion added this to the 2.5.0 milestone Dec 18, 2024
YunWZ pushed a commit to YunWZ/nacos that referenced this pull request Dec 23, 2024
…rmly use UTF-8 encoding for md5 fields (alibaba#12931)

* Refactor ConfigCache and related pathways optimize encoding for md5 fields. Utilize the SPI mechanism in related pathways and methods to ensure extensibility for config cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants