Skip to content

[Dubbo-fix]: polish LFUCache#5994

Merged
AlbumenJ merged 1 commit intoapache:masterfrom
tangcent:review/#5734
Mar 15, 2021
Merged

[Dubbo-fix]: polish LFUCache#5994
AlbumenJ merged 1 commit intoapache:masterfrom
tangcent:review/#5734

Conversation

@tangcent
Copy link
Copy Markdown
Contributor

What is the purpose of the change

review #5734

Brief changelog

  • Rename constants to represent what it means:
    DEFAULT_LOAD_FACTOR -> DEFAULT_CAPACITY
    DEFAULT_EVICTION_CAPACITY -> DEFAULT_EVICTION_FACTOR
  • Refactor codes:
if (map.containsKey(key)) {
         node = map.get(key);
         if (node != null) {
               CacheNode.withdrawNode(node);
         }
         node.value = value;
         freqTable[0].addLastNode(node);
         map.put(key, node);
 }
  • Add test case org.apache.dubbo.common.utils.LRUCacheTest#testErrorConstructArguments.

Verifying this change

Run test case org.apache.dubbo.common.utils.LRUCacheTest

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

  • Make sure there is a GITHUB_issue field 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 [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. 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 sample in dubbo samples project.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 10, 2020

Codecov Report

Merging #5994 (0f0905c) into master (279699f) will decrease coverage by 0.01%.
The diff coverage is 40.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #5994      +/-   ##
============================================
- Coverage     58.65%   58.64%   -0.02%     
  Complexity      424      424              
============================================
  Files          1043     1043              
  Lines         42473    42472       -1     
  Branches       6212     6211       -1     
============================================
- Hits          24912    24907       -5     
- Misses        14773    14779       +6     
+ Partials       2788     2786       -2     
Impacted Files Coverage Δ Complexity Δ
...n/java/org/apache/dubbo/common/utils/LFUCache.java 84.31% <40.00%> (+4.70%) 0.00 <0.00> (ø)
.../remoting/transport/netty4/NettyClientHandler.java 67.79% <0.00%> (-16.95%) 0.00% <0.00%> (ø%)
...in/java/org/apache/dubbo/common/utils/JVMUtil.java 81.13% <0.00%> (-11.33%) 0.00% <0.00%> (ø%)
.../apache/dubbo/remoting/transport/AbstractPeer.java 58.69% <0.00%> (-4.35%) 0.00% <0.00%> (ø%)
.../dubbo/remoting/transport/netty4/NettyChannel.java 63.36% <0.00%> (-1.00%) 0.00% <0.00%> (ø%)
...e/dubbo/remoting/exchange/codec/ExchangeCodec.java 74.56% <0.00%> (-0.88%) 0.00% <0.00%> (ø%)
.../apache/dubbo/config/bootstrap/DubboBootstrap.java 42.01% <0.00%> (+0.31%) 0.00% <0.00%> (ø%)
...e/dubbo/remoting/transport/netty4/NettyServer.java 73.52% <0.00%> (+2.94%) 0.00% <0.00%> (ø%)
...c/main/java/org/apache/dubbo/rpc/RpcException.java 83.33% <0.00%> (+3.33%) 0.00% <0.00%> (ø%)
...ava/org/apache/dubbo/config/DubboShutdownHook.java 74.46% <0.00%> (+10.63%) 0.00% <0.00%> (ø%)
... and 1 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 279699f...0f0905c. Read the comment docs.

@tangcent tangcent changed the title polish LFUCache [Dubbo-fix]: polish LFUCache Apr 11, 2020
Copy link
Copy Markdown

@superleo-cn superleo-cn left a comment

Choose a reason for hiding this comment

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

LGTM. Approved.

@tangcent
Copy link
Copy Markdown
Contributor Author

@chickenlj
PTAL, Fell free to close it if it has be included in other PRs or It is not expected to change. Thanks.

@AlbumenJ
Copy link
Copy Markdown
Member

@tangcent hi, thanks for your contribution

pls resolve confilcts with the latest master branch

@AlbumenJ AlbumenJ added the status/waiting-for-feedback Need reporters to triage label Mar 14, 2021
@tangcent
Copy link
Copy Markdown
Contributor Author

@AlbumenJ done.

@AlbumenJ AlbumenJ merged commit 2112edc into apache:master Mar 15, 2021
AlbumenJ added a commit to AlbumenJ/dubbo that referenced this pull request May 28, 2021
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.64%. Comparing base (279699f) to head (0f0905c).

Files with missing lines Patch % Lines
...n/java/org/apache/dubbo/common/utils/LFUCache.java 40.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5994      +/-   ##
============================================
- Coverage     58.65%   58.64%   -0.02%     
  Complexity      424      424              
============================================
  Files          1043     1043              
  Lines         42473    42472       -1     
  Branches       6212     6211       -1     
============================================
- Hits          24912    24907       -5     
- Misses        14773    14779       +6     
+ Partials       2788     2786       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/waiting-for-feedback Need reporters to triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants