diff --git a/ddl/ddl.go b/ddl/ddl.go index 7cf497515d058..08ebffb9d9433 100644 --- a/ddl/ddl.go +++ b/ddl/ddl.go @@ -326,6 +326,8 @@ func (d *ddl) Start(ctxPool *pools.ResourcePool) error { d.wg.Add(1) go d.limitDDLJobs() + d.sessPool = newSessionPool(ctxPool) + // If RunWorker is true, we need campaign owner and do DDL job. // Otherwise, we needn't do that. if RunWorker { @@ -335,7 +337,6 @@ func (d *ddl) Start(ctxPool *pools.ResourcePool) error { } d.workers = make(map[workerType]*worker, 2) - d.sessPool = newSessionPool(ctxPool) d.delRangeMgr = d.newDeleteRangeManager(ctxPool == nil) d.workers[generalWorker] = newWorker(generalWorker, d.store, d.sessPool, d.delRangeMgr) d.workers[addIdxWorker] = newWorker(addIdxWorker, d.store, d.sessPool, d.delRangeMgr)