Skip to content

ttl: fix the infinite waiting for delRateLimiter when tidb_ttl_delete_rate_limit changes#58485

Merged
ti-chi-bot[bot] merged 1 commit intopingcap:masterfrom
lcwangchao:fix_ttl_rate_limiter_block
Dec 24, 2024
Merged

ttl: fix the infinite waiting for delRateLimiter when tidb_ttl_delete_rate_limit changes#58485
ti-chi-bot[bot] merged 1 commit intopingcap:masterfrom
lcwangchao:fix_ttl_rate_limiter_block

Conversation

@lcwangchao
Copy link
Copy Markdown
Collaborator

@lcwangchao lcwangchao commented Dec 23, 2024

What problem does this PR solve?

Issue Number: close #58484

Problem Summary:

Copied from PR, the below comments describe how this bug happens.

//  1. The `tidb_ttl_delete_rate_limit` set to some non-zero value such as 128.
//  2. Some delWorker delete rows concurrency and try to wait for the inner `rate.Limiter`.
//  3. Before internal `l.limiter.Wait` is called, the `tidb_ttl_delete_rate_limit` is set to 0.
//     It resets the internal `rate.Limiter` (in the bug codes, its rate is set to 0).
//  4. The delWorkers in step 2 continue to call l.limiter.Wait.
//     In the bug codes, some of them are blocked forever because the rate is set to 0.

What changed and how does it work?

Set the inner limiter rate to rate.Inf when tidb_ttl_delete_rate_limit is set to 0

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

ttl: fix the infinite waiting for delRateLimiter when `tidb_ttl_delete_rate_limit` changes

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 23, 2024
@tiprow
Copy link
Copy Markdown

tiprow bot commented Dec 23, 2024

Hi @lcwangchao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

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 kubernetes-sigs/prow repository.

@lcwangchao lcwangchao requested a review from YangKeao December 23, 2024 10:20
@lcwangchao lcwangchao force-pushed the fix_ttl_rate_limiter_block branch 2 times, most recently from 557c2a5 to 05aa1ab Compare December 23, 2024 10:38
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 23, 2024
@lcwangchao lcwangchao force-pushed the fix_ttl_rate_limiter_block branch from 05aa1ab to d62e4ec Compare December 23, 2024 10:38
@lcwangchao lcwangchao force-pushed the fix_ttl_rate_limiter_block branch from d62e4ec to 17dec34 Compare December 23, 2024 10:53
Copy link
Copy Markdown
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 23, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.4952%. Comparing base (52de47d) to head (17dec34).
Report is 269 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58485        +/-   ##
================================================
- Coverage   73.5398%   73.4952%   -0.0447%     
================================================
  Files          1681       1681                
  Lines        464075     467116      +3041     
================================================
+ Hits         341280     343308      +2028     
- Misses       101975     103032      +1057     
+ Partials      20820      20776        -44     
Flag Coverage Δ
integration 43.2904% <6.6666%> (?)
unit 72.4116% <100.0000%> (+0.1050%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.2614% <ø> (-0.5309%) ⬇️

@lcwangchao
Copy link
Copy Markdown
Collaborator Author

/retest

@tiprow
Copy link
Copy Markdown

tiprow bot commented Dec 23, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

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 kubernetes-sigs/prow repository.

Copy link
Copy Markdown
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Dec 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bb7133, YangKeao

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

The pull request process is described here

Details 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 and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 24, 2024
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Dec 24, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-23 11:05:45.180907284 +0000 UTC m=+1473335.269709812: ☑️ agreed by YangKeao.
  • 2024-12-24 02:50:26.519970275 +0000 UTC m=+1530016.608772806: ☑️ agreed by bb7133.

@ti-chi-bot ti-chi-bot bot merged commit 392fb75 into pingcap:master Dec 24, 2024
@lcwangchao lcwangchao deleted the fix_ttl_rate_limiter_block branch December 24, 2024 06:37
@lcwangchao lcwangchao added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Jan 6, 2025
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 6, 2025
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #58718.

@lcwangchao
Copy link
Copy Markdown
Collaborator Author

/cherry-pick release-8.5

@ti-chi-bot
Copy link
Copy Markdown
Member

@lcwangchao: new pull request created to branch release-8.5: #58787.

Details

In response to this:

/cherry-pick release-8.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.

ti-chi-bot bot pushed a commit that referenced this pull request Jan 8, 2025
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Feb 11, 2025
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Feb 11, 2025
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Copy Markdown
Member

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

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

Labels

approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

ttl: delWorker maybe blocked forever in concurrency

4 participants