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

statistics: add gc in hot peer cache #8702

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Oct 14, 2024

What problem does this PR solve?

Issue Number: Close #8698

What is changed and how does it work?

Check List

Tests

  • Unit test

Release note

None.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 14, 2024
Signed-off-by: lhy1024 <[email protected]>
Signed-off-by: lhy1024 <[email protected]>
Signed-off-by: lhy1024 <[email protected]>
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.77%. Comparing base (48e72f1) to head (f2d03a9).
Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8702      +/-   ##
==========================================
+ Coverage   71.70%   71.77%   +0.07%     
==========================================
  Files         517      517              
  Lines       67450    67477      +27     
==========================================
+ Hits        48364    48432      +68     
+ Misses      15521    15487      -34     
+ Partials     3565     3558       -7     
Flag Coverage Δ
unittests 71.77% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@lhy1024 lhy1024 requested a review from rleungx October 16, 2024 06:47
@@ -115,6 +116,7 @@ func (f *HotPeerCache) UpdateStat(item *HotPeerStat) {
return
}
f.incMetrics(item.actionType, item.StoreID)
f.removeExpiredItems()
Copy link
Member

Choose a reason for hiding this comment

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

Will it be called every time we receive a region heartbeat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In previous, removeItem or putItem will call tn.maintain() every time. In this PR, it will call only after topNTTL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

L554-L556

@@ -80,7 +80,7 @@ func (w *HotCache) CheckReadAsync(task func(cache *HotPeerCache)) bool {
func (w *HotCache) RegionStats(kind utils.RWType, minHotDegree int) map[uint64][]*HotPeerStat {
ret := make(chan map[uint64][]*HotPeerStat, 1)
collectRegionStatsTask := func(cache *HotPeerCache) {
ret <- cache.RegionStats(minHotDegree)
ret <- cache.PeerStats(minHotDegree)
Copy link
Member

Choose a reason for hiding this comment

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

Why change the name, it's not consistent with other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll keep the TODO and change them in another PR uniform.

@lhy1024
Copy link
Contributor Author

lhy1024 commented Oct 22, 2024

/check-issue-triage-complete

Copy link
Contributor

ti-chi-bot bot commented Oct 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rleungx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 22, 2024
Copy link
Contributor

ti-chi-bot bot commented Oct 22, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-22 08:00:06.328372797 +0000 UTC m=+338007.025163402: ☑️ agreed by rleungx.

@ti-chi-bot ti-chi-bot bot added the approved label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Region may not be removed in hot peer cache after merging
2 participants