-
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
ddl: fix the covert job to rollingback job #23903
Conversation
Signed-off-by: AilinKid <314806019@qq.com>
Signed-off-by: AilinKid <314806019@qq.com>
ddl/rollingback.go
Outdated
} | ||
errorCount := variable.GetDDLErrorCountLimit() | ||
if job.ErrorCount > errorCount { | ||
msg := fmt.Sprintf("job being converted to rollback job errors and error count beyond the limitation %d, cancelled", errorCount) |
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.
msg := fmt.Sprintf("job being converted to rollback job errors and error count beyond the limitation %d, cancelled", errorCount) | |
logutil.Logger(w.logCtx).Warn("[ddl] rollback DDL job error count exceed the limit, cancelled it now", zap.Int64("jobID", job.ID), zap.Int64("errorCountLimit", errorCount)) |
Unify the logs in runDDL
and this function.
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.
addressed
Signed-off-by: AilinKid <314806019@qq.com>
ddl/rollingback.go
Outdated
errorCount := variable.GetDDLErrorCountLimit() | ||
if job.ErrorCount > errorCount { | ||
logutil.Logger(w.logCtx).Warn("[ddl] rollback DDL job error count exceed the limit, cancelled it now", zap.Int64("jobID", job.ID), zap.Int64("errorCountLimit", errorCount)) | ||
job.Error = toTError(errors.New(fmt.Sprintf(fmt.Sprintf(" rollback DDL job error count exceed the limit %d, cancelled it now", errorCount)))) |
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.
job.Error = toTError(errors.New(fmt.Sprintf(fmt.Sprintf(" rollback DDL job error count exceed the limit %d, cancelled it now", errorCount)))) | |
job.Error = toTError(errors.New(fmt.Sprintf(fmt.Sprintf("rollback DDL job error count exceed the limit %d, cancelled it now", errorCount)))) |
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
Signed-off-by: AilinKid <314806019@qq.com>
/lgtm |
/lgtm |
[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 writing |
/approve |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 0d3e800
|
/merge |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.0 in PR #24080 |
/run-cherry-picker |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #24445 |
Signed-off-by: AilinKid 314806019@qq.com
What problem does this PR solve?
Issue Number: close #23893
Once
convertJob2RollbackJob
meets error, the job state can't be set asJobStateRollingback
sincejob state and args may not be correctly overwritten. The job will be fetched to run with the canceling
state again. So we should check the error count here.
What is changed and how it works?
What's Changed:
change all the rollingback assignments to the last step in all ddl canceling logic.
This is aim to get rid of invalid job state and job args, while the job is assigned with rollingback state, which will lead errors in following rollingback logic, for example, json unmarshal error.
Add error count check and force it be canceled in convertJob2RollbackJob
This is aim to get rid of the infinite loop of canceling action once
convertJob2RollbackJob
gets an error.Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Release note