-
Notifications
You must be signed in to change notification settings - Fork 728
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
cache: lazy gc in ttl #9048
cache: lazy gc in ttl #9048
Conversation
Signed-off-by: 童剑 <1045931706@qq.com>
pkg/cache/ttl.go
Outdated
@@ -163,6 +163,11 @@ func (c *ttlCache) doGC() { | |||
} | |||
} | |||
} | |||
if len(c.items) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about remove
and pop
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't matter, one gc interval will exit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, I have added one atomic flag to check the goroutine exist.
Signed-off-by: 童剑 <1045931706@qq.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #9048 +/- ##
==========================================
+ Coverage 75.58% 76.25% +0.66%
==========================================
Files 332 467 +135
Lines 33913 71155 +37242
==========================================
+ Hits 25634 54260 +28626
- Misses 6074 13513 +7439
- Partials 2205 3382 +1177
Flags with carried forward coverage won't be shown. Click here to find out more. |
/test pull-integration-realcluster-test |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: okJiang, 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 |
close tikv#9047 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
close tikv#9047 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@bufferflies: You cannot manually add or delete the cherry pick branch category labels. It will be added automatically by bot when the PR is created. In response to adding label named type/cherry-pick-for-release-6.5. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
@bufferflies: You cannot manually add or delete the cherry pick branch category labels. It will be added automatically by bot when the PR is created. In response to adding label named type/cherry-pick-for-release-7.1. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
close #9047 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Signed-off-by: 童剑 <1045931706@qq.com> Co-authored-by: tongjian <1045931706@qq.com> Co-authored-by: 童剑 <1045931706@qq.com> Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
What problem does this PR solve?
Issue Number: Close #9047
What is changed and how does it work?
Check List
Tests
6.5.6 fixed
![image](https://private-user-images.githubusercontent.com/23159587/411209478-0fef85ff-2dac-41cf-86e4-cfa1cf975de8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NTQyNDgsIm5iZiI6MTczOTQ1Mzk0OCwicGF0aCI6Ii8yMzE1OTU4Ny80MTEyMDk0NzgtMGZlZjg1ZmYtMmRhYy00MWNmLTg2ZTQtY2ZhMWNmOTc1ZGU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDEzMzkwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE3NTExYjZjZmMzMmM2YWMyNmFmZmE4ZDBiYjJiMDlkMGRkYWYxZGQzNDlkMTQwZTU5ZmFjNmRkMjAzMTlkNWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.22HgaBoEqM-yfO9MDTJ61sXJoPBMaxYtXpDdUNDFTgE)
Code changes
Side effects
Related changes
Release note