-
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: add recover for run ddl job #10981
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10981 +/- ##
===========================================
Coverage 81.0665% 81.0665%
===========================================
Files 421 421
Lines 89577 89577
===========================================
Hits 72617 72617
Misses 11725 11725
Partials 5235 5235 |
ddl/ddl_worker.go
Outdated
@@ -471,6 +472,18 @@ func chooseLeaseTime(t, max time.Duration) time.Duration { | |||
|
|||
// runDDLJob runs a DDL job. It returns the current schema version in this transaction and the error. | |||
func (w *worker) runDDLJob(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, err error) { | |||
defer func() { | |||
r := recover() |
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.
Could we use WithRecovery
?
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.
done.
ddl/ddl_worker.go
Outdated
logutil.BgLogger().Error("run ddl job panic", | ||
zap.Reflect("r", r), | ||
zap.Stack("stack trace")) | ||
job.State = model.JobStateCancelling |
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.
add some comments, why cancel the job here.
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.
done.
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
/run-all-tests |
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
LGTM |
/run-all-tests |
/run-unit-test |
What problem does this PR solve?
Fix ddl worker run ddl job panic.
What is changed and how it works?
runDDLJob
function.Check List
Tests
Code changes
Side effects
Related changes