ttl: implement ttl job schedule framework#39472
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. DetailsReviewer can indicate their review by submitting an approval review. |
15885a8 to
8b275b1
Compare
a359fc7 to
1d0d7c2
Compare
1d0d7c2 to
8eb9302
Compare
|
8eb9302 to
1d5d30d
Compare
1d5d30d to
c9fc7f9
Compare
4b46c4a to
c1effd3
Compare
|
/run-mysql-test |
e0be974 to
c091e49
Compare
ttl/ttlworker/job_manager.go
Outdated
There was a problem hiding this comment.
seems when a job's hbtime stops to update, a new job with a new ttl expire will be created. I'm not sure whether we should make a little more complex strategy to make the job can be "resume" instead a new job. This maybe useful in some cases, for example, if we have a bug that a job will crash after running for 1hour, it still can guarantee a job will be finished finally and make sure the "cleared watermark" can be pushed forward.
There was a problem hiding this comment.
If we want to implement the "resume", another thing we should concern is that if a very old job failed, we should not resume it.
ttl/ttlworker/job_manager.go
Outdated
There was a problem hiding this comment.
tableStatus.CurrentJobOwnerID != m.id means this job is take over by other worker, so is it necessary to reset the job's status in this node?
There was a problem hiding this comment.
reset the job's status in this node
Remove it from the running job and cancelling all running tasks are the only "status" local . The manager cannot get the job anymore 🤔, so I don't think other states matter.
|
Tough we still have some details to discuss, but I think we can merge it first to do some tests. |
6c68a80 to
ab70f7f
Compare
|
@hawkingrei @lcwangchao Could you help me to merge this PR? |
|
/hold I found a bug 🤦 |
Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
|
/unhold |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: 41326e0 |
|
/run-unit-test. |
|
/run-unit-test |
1 similar comment
|
/run-unit-test |
|
hello from wuhuizuo |
|
In response to a cherrypick label: new pull request created to branch |
TiDB MergeCI notify✅ Well Done! New fixed [1] after this pr merged.
|
What problem does this PR solve?
Issue Number: close #39471
Problem Summary:
Implement a ttl job schedule framework. It reads information from the info schema and the
mysql.tidb_ttl_table_status, gets the job to run and schedule them to a scan worker.The implementation of variable settings,
scanWorkeranddelWorkerare left for future development.What is changed and how it works?
For most parts, the job manager is split from the original demo: https://github.com/pingcap/tidb/pull/39320/files. It implements the following feature:
This pr left a lot of TODO for system variables. They are left in #39727.
Check List
Tests