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
disttask: support detectTask
in parallel and do some updates for dispatcher
#42454
disttask: support detectTask
in parallel and do some updates for dispatcher
#42454
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. |
ec03e0c
to
cb02147
Compare
Unstable test: #42461 |
/test unit-test |
/retest |
// TODO: UpdateTask and AddNewTask in a txn. | ||
prevState := gTask.State | ||
defer func() { | ||
if err != nil { |
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.
A better way to handle the error is discard the task info in the memory and refetch it from storage because we do not know either the operation is succeed or not. Morever, the refetch operation still can return an error, so we need retry it until success.
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.
Generally, the reason for the error here is to update data to the storage layer error, the result is still to obtain information from the storage layer, feeling that the probability of failure is relatively large. It feels better to do a copy before this operation, and then do a copy after the operation is successful. But I'm only checking state so I'm just going to do it right now.
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.
We should consider one scene the network request succeed but failed to response to client. If we revert the state in memory, this reverted state is wrong.
/test unit-test |
/test all |
b741c93
to
4afe50c
Compare
/test check-dev2 |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 4afe50c
|
What problem does this PR solve?
Issue Number: close #42383, close #42369
Problem Summary:
What is changed and how it works?
detectTask
in paralleldetectTask
)Using
spool.Pool
instead oftidbutil.WaitGroupWrapper
to new a goroutine.Handle the TODO of
Consider get all unfinished tasks.
If updating task/subtasks to the storage fails, ensure that the gTask state is not changed in cache.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.