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

Closed
wants to merge 30 commits into from

Conversation

Sunrisea
Copy link
Contributor

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.

… 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.
Copy link

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格式)。

@wuyfee
Copy link

wuyfee commented Nov 21, 2024

$\color{red}{FAILURE}$
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): failure
✅ - e2e-csharp-test (standalone & cluster): success
✅ - e2e-nodejs-test (standalone & cluster): success
✅ - e2e-python-test (standalone & cluster): success
✅ - clean (standalone & cluster & standalone_auth): success

* @param lastModifiedTs the last modified ts
* @return the config cache
*/
public ConfigCache createConfigCache(String md5, long lastModifiedTs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

interface中减少方法数量,仅透出createConfigCache(),createConfigCacheGray() ,
比如

可在次基础上在ConfigCacheFactoryDelegate中重载提供四个方法,内部调用ConfigCacheFactory中的原子方法进行二次封装

}

public ConfigCacheGray createConfigCacheGray(String grayName) {
return configCacheFactory.createConfigCacheGray(grayName);
Copy link
Collaborator

Choose a reason for hiding this comment

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

改为
ConfigCacheGray configGray=configCacheFactory.createConfigCacheGray();
configGray.setGrayName(grayName);

}

public ConfigCache createConfigCache(String md5, long lastModifiedTs) {
return configCacheFactory.createConfigCache(md5, lastModifiedTs);
Copy link
Collaborator

Choose a reason for hiding this comment

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

改为
ConfigCache configGray=this.createConfigCachhe();
configGray.setMd5(md5);
configGray.setlastModifiedTs(lastModifiedTs);

*
* @author Sunrisea
*/
public interface ConfigCacheMd5PostProcessor {
Copy link
Collaborator

@shiyiyue1102 shiyiyue1102 Nov 21, 2024

Choose a reason for hiding this comment

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

类名上可以不要透出md5,不要在开源侧过多展示md5相关的语义

@wuyfee
Copy link

wuyfee commented Nov 21, 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

@wuyfee
Copy link

wuyfee commented Nov 21, 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

@wuyfee
Copy link

wuyfee commented Nov 21, 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

@wuyfee
Copy link

wuyfee commented Nov 21, 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

@wuyfee
Copy link

wuyfee commented Nov 21, 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

@wuyfee
Copy link

wuyfee commented Nov 21, 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

@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

Codecov Report

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

Project coverage is 72.28%. Comparing base (aeaaded) to head (3042bf2).
Report is 7 commits behind head on develop.

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   #12876      +/-   ##
=============================================
+ Coverage      72.17%   72.28%   +0.11%     
- Complexity      9792     9855      +63     
=============================================
  Files           1283     1293      +10     
  Lines          41387    41522     +135     
  Branches        4374     4384      +10     
=============================================
+ Hits           29872    30016     +144     
+ Misses          9408     9398      -10     
- Partials        2107     2108       +1     
Files with missing lines Coverage Δ
...server/configuration/NacosConfigConfiguration.java 0.00% <ø> (ø)
...s/config/server/controller/ConfigServletInner.java 85.95% <100.00%> (-0.12%) ⬇️
...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%> (ø)
...onfig/server/remote/ConfigQueryRequestHandler.java 86.41% <100.00%> (-0.17%) ⬇️
...com/alibaba/nacos/config/server/utils/MD5Util.java 80.30% <100.00%> (-2.60%) ⬇️
.../nacos/config/server/utils/NacosMd5Comparator.java 100.00% <100.00%> (ø)
...acos/config/server/service/ConfigCacheService.java 74.35% <86.66%> (+0.33%) ⬆️
... and 4 more

... and 15 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 aeaaded...3042bf2. Read the comment docs.

---- 🚨 Try these New Features:

@wuyfee
Copy link

wuyfee commented Nov 21, 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

LOGGER.info("[ConfigCacheFactory] Load ConfigCacheFactory({}) ConfigCacheFactoryName({}) successfully. ",
each.getClass(), each.getConfigCacheFactoryName());
if (StringUtils.equals(configCacheFactoryType, each.getConfigCacheFactoryName())) {
this.configCacheFactory = each;
Copy link
Collaborator

Choose a reason for hiding this comment

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

add log , load specific config cache factory successfully with name {name}

}
}
if (this.configCacheFactory == null) {
this.configCacheFactory = new NacosConfigCacheFactory();
Copy link
Collaborator

Choose a reason for hiding this comment

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

add log , load default config cache factory successfully

@wuyfee
Copy link

wuyfee commented Nov 25, 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

ifrankwang and others added 2 commits December 3, 2024 09:46
…edirected to the login page without pop-ups. (related issue alibaba#11153) (alibaba#12907)

* Remove excess code.(related issue alibaba#12871 )

* Log in to the console through a browser http://ip:8848/nacos and be redirected to the login page without pop-ups. (related issue alibaba#11153)
KiteSoar and others added 17 commits December 4, 2024 09:55
…12892)

 config query chain of responsibility model refactor
alibaba#12805)

* The error message is not user-friendly when adding duplicate permissions. (alibaba#12273)

* The error message is not user-friendly when adding duplicate permissions. (alibaba#12773)

* add some unit test.

* fix ci fail.
alibaba#12803)

* The error message is not user-friendly when adding duplicate permissions. (alibaba#12773)

* The error message is not user-friendly when adding duplicate permissions.(alibaba#12773)
…cilitate the extension and implementation of databases like Oracle. (alibaba#12343)

* Improve the retrieval of ConfigInfoState to facilitate the extension and implementation of databases like Oracle.

* Add unit tests for the SQL construction part of the `ExternalConfigInfoPersistServiceImpl#findConfigInfoState` method.

* Enhance the construction of the delete statement in AbstractMapper by using a unified appendWhereClause method to construct the WHERE clause. Modify appendWhereClause to be protected, allowing for customization based on different database types, such as adjustments according to column names.
… 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.
…p-issue#12872

# Conflicts:
#	config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigServletInner.java
#	config/src/main/java/com/alibaba/nacos/config/server/remote/ConfigQueryRequestHandler.java
#	config/src/test/java/com/alibaba/nacos/config/server/controller/ConfigServletInnerTest.java
@Sunrisea Sunrisea closed this Dec 9, 2024
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.