Skip to content

Automatically de-duplicate rules when loading rules - #571

Merged
sczyh30 merged 2 commits into
masterfrom
enhancement/deduplicate-rules
Mar 14, 2019
Merged

Automatically de-duplicate rules when loading rules#571
sczyh30 merged 2 commits into
masterfrom
enhancement/deduplicate-rules

Conversation

@sczyh30

@sczyh30 sczyh30 commented Mar 13, 2019

Copy link
Copy Markdown
Member

Describe what this PR does / why we need it

Automatically de-duplicate rules when loading rules. When there are duplicate FlowRule or DegradeRule, it might not work as expected.

Does this pull request fix one issue?

NONE

Describe how you did it

This PR does not contain breaking changes for public methods or interfaces.

  • De-duplicate rules when resolving from new rule list. For compatibility, we did not modify the original loadRules and register2Property method. We only de-duplicate the rules internally.
  • Add setRulesForResource to support replace rules for a specific resource, while others remain unchanged.
  • Log enhancement

Describe how to verify it

Run the test cases.

Special notes for reviews

NONE

- also code refinement

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@sczyh30 sczyh30 added the to-review To review label Mar 13, 2019
@sczyh30
sczyh30 requested a review from CarpenterLee March 13, 2019 14:42
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@codecov-io

codecov-io commented Mar 14, 2019

Copy link
Copy Markdown

Codecov Report

Merging #571 into master will increase coverage by 1.41%.
The diff coverage is 47.87%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #571      +/-   ##
============================================
+ Coverage     39.09%   40.51%   +1.41%     
- Complexity     1196     1314     +118     
============================================
  Files           271      276       +5     
  Lines          8494     8941     +447     
  Branches       1134     1212      +78     
============================================
+ Hits           3321     3622     +301     
- Misses         4754     4872     +118     
- Partials        419      447      +28
Impacted Files Coverage Δ Complexity Δ
...csp/sentinel/slots/block/flow/FlowRuleManager.java 60.86% <0%> (-1.36%) 7 <0> (ø)
.../sentinel/slots/block/authority/AuthoritySlot.java 88.23% <100%> (ø) 7 <4> (ø) ⬇️
...ntinel/slots/block/degrade/DegradeRuleManager.java 21.27% <14.58%> (-5.12%) 7 <2> (ø)
...el/slots/block/authority/AuthorityRuleManager.java 63.79% <72.22%> (-1.12%) 9 <3> (ø)
...ba/csp/sentinel/slots/block/flow/FlowRuleUtil.java 50% <90%> (+2.23%) 19 <7> (-1) ⬇️
...l/slots/block/flow/param/ParamFlowRuleManager.java 75% <93.33%> (-1.2%) 7 <6> (ø)
...a/com/alibaba/csp/sentinel/node/StatisticNode.java 63.1% <0%> (-17.54%) 34% <0%> (+6%)
.../csp/sentinel/slots/statistic/base/WindowWrap.java 66.66% <0%> (-10.26%) 6% <0%> (+1%)
...slots/block/flow/controller/DefaultController.java 54.54% <0%> (-7.96%) 12% <0%> (+6%)
...p/sentinel/slots/statistic/metric/ArrayMetric.java 73.03% <0%> (-5.92%) 44% <0%> (+16%)
... and 19 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 4b1ccd9...379d17a. Read the comment docs.

@sczyh30 sczyh30 added this to the 1.5.0 milestone Mar 14, 2019

@CarpenterLee CarpenterLee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@sczyh30
sczyh30 merged commit 1741da0 into master Mar 14, 2019
@sczyh30 sczyh30 removed the to-review To review label Mar 14, 2019
@sczyh30
sczyh30 deleted the enhancement/deduplicate-rules branch March 14, 2019 06:05
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