ddl: wait 1pc only once for ddl reorg job (#24859)

This commit is contained in:
Arenatlx
2021-05-25 12:53:33 +08:00
committed by GitHub
parent d5f01e1477
commit 64bf4b1904

View File

@ -156,11 +156,6 @@ func (rc *reorgCtx) clean() {
}
func (w *worker) runReorgJob(t *meta.Meta, reorgInfo *reorgInfo, tblInfo *model.TableInfo, lease time.Duration, f func() error) error {
// lease = 0 means it's in an integration test. In this case we don't delay so the test won't run too slowly.
if lease > 0 {
delayForAsyncCommit()
}
job := reorgInfo.Job
// This is for tests compatible, because most of the early tests try to build the reorg job manually
// without reorg meta info, which will cause nil pointer in here.
@ -172,6 +167,12 @@ func (w *worker) runReorgJob(t *meta.Meta, reorgInfo *reorgInfo, tblInfo *model.
}
}
if w.reorgCtx.doneCh == nil {
// Since reorg job will be interrupted for polling the cancel action outside. we don't need to wait for 2.5s
// for the later entrances.
// lease = 0 means it's in an integration test. In this case we don't delay so the test won't run too slowly.
if lease > 0 {
delayForAsyncCommit()
}
// start a reorganization job
w.wg.Add(1)
w.reorgCtx.doneCh = make(chan error, 1)