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

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

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

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

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.

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

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 7 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
Collaborator Author

/retest

Copy link

tiprow bot commented Dec 23, 2024

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

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

Copy link

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

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

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
24 checks passed
@lcwangchao lcwangchao deleted the fix_ttl_rate_limiter_block branch December 24, 2024 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm 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
3 participants