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

fix potential data inconsistency issue #3341

Conversation

nobodyiam
Copy link
Member

What's the purpose of this PR

fix potential data inconsistency issue

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

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.

@codecov-io
Copy link

codecov-io commented Oct 18, 2020

Codecov Report

Merging #3341 into master will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3341      +/-   ##
============================================
- Coverage     51.46%   51.43%   -0.04%     
- Complexity     2302     2303       +1     
============================================
  Files           442      442              
  Lines         13738    13741       +3     
  Branches       1398     1399       +1     
============================================
- Hits           7070     7067       -3     
- Misses         6181     6188       +7     
+ Partials        487      486       -1     
Impacted Files Coverage Δ Complexity Δ
...apollo/adminservice/controller/ItemController.java 8.43% <0.00%> (-0.32%) 2.00 <0.00> (ø)
...ework/apollo/portal/controller/ItemController.java 14.94% <0.00%> (ø) 2.00 <0.00> (ø)
...ework/apollo/internals/RemoteConfigRepository.java 86.25% <0.00%> (-3.13%) 24.00% <0.00%> (-1.00%)
.../apollo/internals/RemoteConfigLongPollService.java 78.31% <0.00%> (+0.60%) 29.00% <0.00%> (+1.00%)
...ervice/service/ReleaseMessageServiceWithCache.java 87.05% <0.00%> (+1.17%) 25.00% <0.00%> (+1.00%)

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 13de50b...16dafc5. Read the comment docs.

@nobodyiam nobodyiam force-pushed the fix-potential-data-inconsistency-issue branch from 71dab1f to 16dafc5 Compare October 19, 2020 00:19
@nobodyiam nobodyiam merged commit fa92051 into apolloconfig:master Oct 19, 2020
@nobodyiam nobodyiam added this to the 1.8.0 milestone Feb 11, 2021
@nobodyiam nobodyiam deleted the fix-potential-data-inconsistency-issue branch January 11, 2022 00:48
@@ -113,7 +113,7 @@ public void deleteItem(@PathVariable String appId, @PathVariable String env,
NamespaceDTO namespace = namespaceService.loadNamespaceBaseInfo(appId, Env.valueOf(env), clusterName, namespaceName);

// In case someone constructs an attack scenario
if (item.getNamespaceId() != namespace.getId()) {
if (namespace == null || item.getNamespaceId() != namespace.getId()) {

Choose a reason for hiding this comment

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

此处的namespace为空的判断是非必要的,因为在113行的loadNamespaceBaseInfo中的逻辑里已经对null做出了抛异常的处理。

Copy link
Member Author

Choose a reason for hiding this comment

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

you are right, but I assume it has no harm so we could leave it as is.

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.

3 participants