Skip to content

Commit

Permalink
ddl: reduce the interval for checking "create table/schema" (#7608)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala authored and zz-jason committed Sep 12, 2018
1 parent 6278543 commit 794c4f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ddl/ddl.go
Expand Up @@ -447,6 +447,9 @@ func checkJobMaxInterval(job *model.Job) time.Duration {
if job.Type == model.ActionAddIndex {
return 3 * time.Second
}
if job.Type == model.ActionCreateTable || job.Type == model.ActionCreateSchema {
return 500 * time.Millisecond
}
return 1 * time.Second
}

Expand Down Expand Up @@ -484,7 +487,7 @@ func (d *ddl) doDDLJob(ctx sessionctx.Context, job *model.Job) error {
jobID := job.ID
// For a job from start to end, the state of it will be none -> delete only -> write only -> reorganization -> public
// For every state changes, we will wait as lease 2 * lease time, so here the ticker check is 10 * lease.
// But we use etcd to speed up, normally it takes less than 1s now, so we use 1s or 3s as the max value.
// But we use etcd to speed up, normally it takes less than 0.5s now, so we use 0.5s or 1s or 3s as the max value.
ticker := time.NewTicker(chooseLeaseTime(10*d.lease, checkJobMaxInterval(job)))
startTime := time.Now()
metrics.JobsGauge.WithLabelValues(job.Type.String()).Inc()
Expand Down

0 comments on commit 794c4f4

Please sign in to comment.