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: use a pessimistic transaction to finish the job (#56516) #56967

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #56516

What problem does this PR solve?

Issue Number: close #56422

Problem Summary:

When the job is finished, and at the same time the task is assigned to some TiDB node, it may fail to finish the job.

What changed and how does it work?

Use the pessimistic transaction to finish job. Then the DELETE ... FROM tidb_ttl_tasks will block UPDATE mysql.tidb_ttl_task SET owner_id = ?... (or in another direction).

If the ttl task is removed, it'll finally be removed by (m *taskManager) checkInvalidTask in the memory.

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.

Fix the issue that a TTL job cannot be finished in some situation.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added 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. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR. labels Oct 29, 2024
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-7.5@f54a797). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-7.5     #56967   +/-   ##
================================================
  Coverage               ?   72.0175%           
================================================
  Files                  ?       1415           
  Lines                  ?     412626           
  Branches               ?          0           
================================================
  Hits                   ?     297163           
  Misses                 ?      95544           
  Partials               ?      19919           
Flag Coverage Δ
unit 72.0175% <80.0000%> (?)

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

Components Coverage Δ
dumpling 52.9400% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 53.5649% <0.0000%> (?)

Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
@YangKeao YangKeao force-pushed the cherry-pick-56516-to-release-7.5 branch from b52a592 to 73898ca Compare October 30, 2024 02:03
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 30, 2024
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

Copy link

ti-chi-bot bot commented Oct 30, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lcwangchao, 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:
  • OWNERS [YangKeao,lcwangchao]

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 Oct 30, 2024
Copy link

ti-chi-bot bot commented Oct 30, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-30 02:19:55.202744758 +0000 UTC m=+402708.041900297: ☑️ agreed by lcwangchao.
  • 2024-10-30 02:59:43.800775404 +0000 UTC m=+405096.639930945: ☑️ agreed by YangKeao.

@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Oct 30, 2024
@hawkingrei
Copy link
Member

/retest

1 similar comment
@YangKeao
Copy link
Member

YangKeao commented Nov 4, 2024

/retest

@ti-chi-bot ti-chi-bot bot merged commit 7917e4a into pingcap:release-7.5 Nov 4, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. 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. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants