From 64bf4b1904b954efea7af8bc6ec33b5a8ff7c2eb Mon Sep 17 00:00:00 2001 From: Arenatlx <314806019@qq.com> Date: Tue, 25 May 2021 12:53:33 +0800 Subject: [PATCH] ddl: wait 1pc only once for ddl reorg job (#24859) --- ddl/reorg.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ddl/reorg.go b/ddl/reorg.go index 37bfe82d4c..6b5048eaa1 100644 --- a/ddl/reorg.go +++ b/ddl/reorg.go @@ -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)