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 issue that the task is not cancelled after transfering owners #57788

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

YangKeao
Copy link
Member

What problem does this PR solve?

Issue Number: close #57784

Problem Summary:

The TTL task is not cancelled after the owner transfers to other TiDB nodes.

What changed and how does it work?

  1. Don't report status when the owner is not myself.
  2. Don't update heartbeat when the owenr is not myself.
  3. Check the affected rows to see whether task manager UPDATE successfully.
  4. Cancel the task after finding that the owner is not myself.

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.

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 do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 28, 2024
@@ -117,7 +117,7 @@ func (s *tableTimerStoreCore) List(ctx context.Context, cond api.Cond) ([]*api.T
}
defer back()

if sessVars := sctx.GetSessionVars(); sessVars.GetEnableIndexMerge() {
if sessVars := sctx.GetSessionVars(); !sessVars.GetEnableIndexMerge() {
Copy link
Member Author

Choose a reason for hiding this comment

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

A tiny typo fix @lcwangchao

@YangKeao
Copy link
Member Author

/check-issue-triage-complete

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.5351%. Comparing base (cbf34b0) to head (11795c2).
Report is 14 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57788        +/-   ##
================================================
+ Coverage   72.8485%   73.5351%   +0.6865%     
================================================
  Files          1677       1679         +2     
  Lines        464432     467095      +2663     
================================================
+ Hits         338332     343479      +5147     
+ Misses       105218     102756      -2462     
+ Partials      20882      20860        -22     
Flag Coverage Δ
integration 43.5193% <0.0000%> (?)
unit 72.3225% <88.0000%> (+0.0628%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 46.0898% <ø> (+0.3760%) ⬆️

@YangKeao YangKeao force-pushed the fix-57784 branch 2 times, most recently from 398ed8c to 04da03a Compare November 28, 2024 08:59
// job not exists but table ttl not enabled
watermark := time.Unix(3600*123, 0)
watermark := time.Unix(3600*123, 0).In(tz)
Copy link
Member Author

Choose a reason for hiding this comment

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

A fix to make this test stable in CI environment (when the SystemLocation is possibly not Local). I've faced the same error in #57718, so I think it's not related to other changes in this PR.

@YangKeao YangKeao requested a review from lcwangchao November 28, 2024 09:02
@YangKeao YangKeao force-pushed the fix-57784 branch 3 times, most recently from 0673dd6 to 1d3f31e Compare November 28, 2024 09:40
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 28, 2024
@YangKeao YangKeao requested a review from zimulala November 29, 2024 04:32
@lcwangchao lcwangchao added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 29, 2024
@YangKeao
Copy link
Member Author

/retest

Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
Copy link
Contributor

@zimulala zimulala 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 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lcwangchao, zimulala

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 [lcwangchao,zimulala]

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 the lgtm label Dec 2, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 2, 2024
Copy link

ti-chi-bot bot commented Dec 2, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-28 10:48:50.082915003 +0000 UTC m=+719917.702569516: ☑️ agreed by lcwangchao.
  • 2024-12-02 09:50:23.876845443 +0000 UTC m=+1062011.496499953: ☑️ agreed by zimulala.

@ti-chi-bot ti-chi-bot bot merged commit 018ab99 into pingcap:master Dec 2, 2024
24 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Dec 2, 2024
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-8.5: #57899.

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-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/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 Task cannot be canceled if the TiDB lost heartbeat
4 participants