Skip to content

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #55561

What changed and how does it work?

  • fix some missed count for ErrorRows
  • if a scan task is finished, it will wait for all rows to be processed. If it is not finished in a certain time, the task will go one to mark itself as finished.

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 do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 21, 2024
Copy link

tiprow bot commented Aug 21, 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 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 Aug 21, 2024
@lcwangchao lcwangchao force-pushed the fix_ttl_hang branch 3 times, most recently from b47a900 to 3944d30 Compare August 21, 2024 12:58
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

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

Project coverage is 75.0851%. Comparing base (1f095a3) to head (8cbad54).
Report is 25 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55572        +/-   ##
================================================
+ Coverage   73.0193%   75.0851%   +2.0658%     
================================================
  Files          1576       1582         +6     
  Lines        440864     453011     +12147     
================================================
+ Hits         321916     340144     +18228     
+ Misses        99271      92389      -6882     
- Partials      19677      20478       +801     
Flag Coverage Δ
integration 48.9622% <6.1538%> (?)
unit 71.8784% <95.3846%> (-0.2205%) ⬇️

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 52.5244% <ø> (+6.5651%) ⬆️

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

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 22, 2024
// All rows are processed.
// We use `<=` instead of `==` to make the logic strong to make sure
// it also works when statistics are not accurate.
logger.Info("mark TTL task finished because all scanned rows are processed")
Copy link
Member

Choose a reason for hiding this comment

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

How about adding a warning for the case t.statistics.ErrorRows.Load()+t.statistics.SuccessRows.Load() > t.statistics.TotalRows.Load(), as we currently don't know when they are not equal.

return true
}

if time.Since(t.result.time) > waitTaskProcessRowsTimeout {
Copy link
Member

Choose a reason for hiding this comment

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

Is two minutes long enough? Previously, the meaning of finished() is that both scan and delete are finished. If we are going to keep the behavior, it means the delete should have finished within 2 minutes, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe I can enlarge it to 5 minutes. The delChan is a channel with 0 zero size, and san worker will only be marked as finished after the delTask emitted. That means we as most waiting tidb_ttl_scan_batch_size rows to deleted. tidb_ttl_scan_batch_size default value is 500, I think it is enough for normal cases

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 Aug 23, 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 Aug 23, 2024
Copy link

ti-chi-bot bot commented Aug 23, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-22 17:49:35.887402351 +0000 UTC m=+460571.021852472: ☑️ agreed by bb7133.
  • 2024-08-23 06:10:00.614894826 +0000 UTC m=+504995.749344952: ☑️ agreed by YangKeao.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Aug 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.

@ti-chi-bot ti-chi-bot bot merged commit 1bf01f4 into pingcap:master Aug 23, 2024
21 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Aug 23, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

@lcwangchao lcwangchao deleted the fix_ttl_hang branch August 23, 2024 08:03
ti-chi-bot bot pushed a commit that referenced this pull request Aug 23, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Aug 23, 2024
ti-chi-bot bot pushed a commit that referenced this pull request Aug 27, 2024
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.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. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TTL job hangs in running state after decreasing tidb_ttl_delete_worker_count
4 participants