Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 committed Feb 13, 2019
1 parent 203d92a commit 3050725
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const (
waitDependencyJobInterval = 200 * time.Millisecond
// noneDependencyJob means a job has no dependency-job.
noneDependencyJob = 0
// ddlErrorCountLimitCnt is the error count limit for ddl job.
ddlErrorCountLimitCnt = 512
)

// worker is used for handling DDL jobs.
Expand Down Expand Up @@ -540,14 +542,13 @@ func (w *worker) runDDLJob(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64,
job.ErrorCount++
// Check error limit to avoid falling into an infinite loop.
if job.ErrorCount > ddlErrorCountLimitCnt && job.State == model.JobStateRunning && admin.IsJobRollbackable(job) == nil {
log.Warnf("[ddl-%s] the job id %v error count exceed the limit, cancelling it now", w,job.ID)
job.State = model.JobStateCancelling
}
}
return
}

const ddlErrorCountLimitCnt = 512

func toTError(err error) *terror.Error {
originErr := errors.Cause(err)
tErr, ok := originErr.(*terror.Error)
Expand Down

0 comments on commit 3050725

Please sign in to comment.