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

cache: lazy gc in ttl #9048

Merged
merged 2 commits into from
Feb 10, 2025
Merged

cache: lazy gc in ttl #9048

merged 2 commits into from
Feb 10, 2025

Conversation

bufferflies
Copy link
Contributor

@bufferflies bufferflies commented Feb 8, 2025

What problem does this PR solve?

Issue Number: Close #9047

What is changed and how does it work?

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

6.5.6 fixed
image

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch

Release note

None.

Signed-off-by: 童剑 <1045931706@qq.com>
@ti-chi-bot ti-chi-bot bot added 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. do-not-merge/needs-linked-issue size/S Denotes a PR that changes 10-29 lines, ignoring generated files. do-not-merge/needs-triage-completed and removed do-not-merge/needs-linked-issue labels Feb 8, 2025
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 8, 2025
pkg/cache/ttl.go Outdated
@@ -163,6 +163,11 @@ func (c *ttlCache) doGC() {
}
}
}
if len(c.items) == 0 {
Copy link
Member

@rleungx rleungx Feb 8, 2025

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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>
Copy link

codecov bot commented Feb 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.25%. Comparing base (bf361c8) to head (14f1101).
Report is 1432 commits behind head on master.

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     
Flag Coverage Δ
unittests 76.25% <100.00%> (+0.66%) ⬆️

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

@bufferflies
Copy link
Contributor Author

/test pull-integration-realcluster-test

Copy link
Contributor

ti-chi-bot bot commented Feb 10, 2025

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm approved and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 10, 2025
Copy link
Contributor

ti-chi-bot bot commented Feb 10, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-08 09:30:17.724182632 +0000 UTC m=+89660.120404694: ☑️ agreed by okJiang.
  • 2025-02-10 02:35:54.25422999 +0000 UTC m=+237596.650452053: ☑️ agreed by rleungx.

@ti-chi-bot ti-chi-bot bot merged commit c92da83 into tikv:master Feb 10, 2025
25 checks passed
@bufferflies bufferflies added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. labels Feb 10, 2025
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 10, 2025
close tikv#9047

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #9053.
But this PR has conflicts, please resolve them!

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #9052.
But this PR has conflicts, please resolve them!

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Feb 10, 2025
close tikv#9047

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@bufferflies bufferflies added type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR. labels Feb 10, 2025
@ti-chi-bot ti-chi-bot bot removed type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR. labels Feb 10, 2025
Copy link
Contributor

ti-chi-bot bot commented Feb 10, 2025

@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.

Copy link
Contributor

ti-chi-bot bot commented Feb 10, 2025

@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.

ti-chi-bot bot pushed a commit that referenced this pull request Feb 11, 2025
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>
ti-chi-bot bot added a commit that referenced this pull request Feb 11, 2025
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>
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. lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

goroutine leak: goroutine increase during the long-term operation
4 participants