Skip to content

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #56539

Problem Summary:

In 6.5, the TTL table is created without meta ttl_job_interval, so after upgraded, the SCHED_POLICY_EXPR in mysql.tidb_timers is also empty that causing the frequent scheduling of TTL job.

What changed and how does it work?

When syncing the timer, insert a default value if ttl_job_interval is empty

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.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 10, 2024
Copy link

tiprow bot commented Oct 10, 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.

@@ -1429,7 +1429,7 @@ func constructResultOfShowCreateTable(ctx sessionctx.Context, dbName *pmodel.CIS
restoreCtx.WriteKeyWord("TTL_JOB_INTERVAL")
restoreCtx.WritePlain("=")
if len(tableInfo.TTLInfo.JobInterval) == 0 {
restoreCtx.WriteString(model.DefaultJobInterval.String())
restoreCtx.WriteString(model.DefaultJobIntervalStr)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should not use model.DefaultJobInterval.String() (return 1h0m0s) as the string interval value because the unit s is not supported in duration.PartionDuration @YangKeao

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 the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 10, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 75.4024%. Comparing base (1e24d39) to head (7e499e1).
Report is 139 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #56540        +/-   ##
================================================
+ Coverage   73.3721%   75.4024%   +2.0302%     
================================================
  Files          1626       1626                
  Lines        448978     450008      +1030     
================================================
+ Hits         329425     339317      +9892     
+ Misses        99368      90021      -9347     
- Partials      20185      20670       +485     
Flag Coverage Δ
integration 48.8067% <0.0000%> (?)
unit 72.4783% <93.3333%> (-0.0043%) ⬇️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 52.3068% <ø> (+6.7168%) ⬆️

Copy link

ti-chi-bot bot commented Oct 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, 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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 11, 2024
Copy link

ti-chi-bot bot commented Oct 11, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-10 09:47:37.697243729 +0000 UTC m=+1125813.117456739: ☑️ agreed by YangKeao.
  • 2024-10-11 03:54:26.264179435 +0000 UTC m=+1191021.684392447: ☑️ agreed by D3Hunter.

@ti-chi-bot ti-chi-bot bot merged commit c827297 into pingcap:master Oct 11, 2024
23 checks passed
@lcwangchao lcwangchao deleted the ttltimerupgrade branch October 11, 2024 05:52
@lcwangchao lcwangchao added needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. labels Oct 12, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Oct 12, 2024
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Oct 12, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Oct 12, 2024
@lcwangchao lcwangchao removed the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Oct 12, 2024
@lcwangchao lcwangchao added needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. needs-cherry-pick-release-8.4 Should cherry pick this PR to release-8.4 branch. labels Oct 29, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout release-8.5: error checking out release-8.5: exit status 1. output: error: pathspec 'release-8.5' did not match any file(s) known to git

@ti-chi-bot
Copy link
Member

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

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.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.4 Should cherry pick this PR to release-8.4 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The scheduling TTL job of table created in v6.5 is particularly frequent after upgraded to 7.5 or later versions
4 participants