-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: Implement scan and delete task for TTL #39481
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-check_dev_2 |
continue | ||
} | ||
|
||
delTask := &ttlDeleteTask{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should delTask
also have some way to send back the execution status? (like the notifyStateCh
above).
The problem I considered is that the job and manager has no idea how much del tasks will be created, so they don't know how much state they will need to wait. But they actually need to know when all tasks have finished 🤔 (to update state, and migrate all fields from current_job_*
to last_job_*
).
A way I could propose is to use a counter to count the number of spawned task of the job, when a task (no matter it's scan or del, and no matter it's error or not) finished, decrease the counter and if the counter arrives 0, update the state and migrate the fields.
When a scan task want to spawn some del task, it could firstly add the counter (by task.tracker.Add()
), and when a task is finished, task.tracker.Done(xxx)
is called (by scan and del worker). 🤔
(For this approach, using function call, or a channel with extra goroutine for each job are both fine. I'm not sure which one is better.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also considered to track del task by scan worker, and track scan task by job (manager). It seems more complicated 🤦 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each task have a ttlStatistics object, I think you can use it to determine whether a all deletions from a scan task is end (by evaluating totalCount == errorCount + successCount).
/run-unit-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 03b8b5f
|
In response to a cherrypick label: new pull request created: #39615. |
TiDB MergeCI notify🔴 Bad News! New failing [1] after this pr merged.
|
What problem does this PR solve?
Issue Number: close #39480 close #39554
Problem Summary:
implement
ttlScanTask
for ttlimplement
ttlDeleteTask
for ttlWhat is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.