-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: update task in framework #46913
Conversation
Hi @ywqzzy. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #46913 +/- ##
================================================
- Coverage 73.2930% 72.6994% -0.5936%
================================================
Files 1329 1353 +24
Lines 397364 403940 +6576
================================================
+ Hits 291240 293662 +2422
- Misses 87542 91629 +4087
- Partials 18582 18649 +67
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -640,32 +640,39 @@ func (stm *TaskManager) UpdateGlobalTaskAndAddSubTasks(gTask *proto.Task, subtas | |||
return err | |||
} | |||
if se.GetSessionVars().StmtCtx.AffectedRows() == 0 { | |||
retryable = false | |||
return errors.New("invalid task state transform, state already changed") | |||
rs, err := ExecSQL(stm.ctx, se, "select id from mysql.tidb_global_task where id = %? and state = %?", gTask.ID, prevState) |
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.
Maybe gtask has no update(currently add index/import into will always change gtask), we need to check if the task have changed its state by admin cancel.
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.
why query it again when StmtCtx.AffectedRows()
is 0?
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.
why query it again when
StmtCtx.AffectedRows()
is 0?
If some onNextStage didn't update gtask, the affectedrows() return 0. But if the state didn't change by other admin command, it's safe to insert subtasks.
This case will not occurred for current add index and import into.
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.
rest lgtm
@@ -640,32 +640,39 @@ func (stm *TaskManager) UpdateGlobalTaskAndAddSubTasks(gTask *proto.Task, subtas | |||
return err | |||
} | |||
if se.GetSessionVars().StmtCtx.AffectedRows() == 0 { | |||
retryable = false | |||
return errors.New("invalid task state transform, state already changed") | |||
rs, err := ExecSQL(stm.ctx, se, "select id from mysql.tidb_global_task where id = %? and state = %?", gTask.ID, prevState) |
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.
why query it again when StmtCtx.AffectedRows()
is 0?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, tangenta 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 |
/retest |
@ywqzzy: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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/test-infra repository. |
/retest |
/test all |
What problem does this PR solve?
Issue Number: ref #46258
Problem Summary:
Framework should updateTask.
What is changed and how it works?
updateTask in framework only.
See comments newly added in task_table.go
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.