diff --git a/ddl/ddl.go b/ddl/ddl.go index f4997c9ac8..bc893096b4 100644 --- a/ddl/ddl.go +++ b/ddl/ddl.go @@ -75,6 +75,9 @@ type ddl struct { uuid string jobCh chan struct{} jobDoneCh chan struct{} + // drop database/table task + taskCh chan struct{} + taskDoneCh chan struct{} // reorgDoneCh is for reorganization, if the reorganization job is done, // we will use this channel to notify outer. // TODO: now we use goroutine to simulate reorganization jobs, later we may @@ -103,6 +106,8 @@ func newDDL(store kv.Storage, infoHandle *infoschema.Handle, hook Callback, leas uuid: uuid.NewV4().String(), jobCh: make(chan struct{}, 1), jobDoneCh: make(chan struct{}, 1), + taskCh: make(chan struct{}, 1), + taskDoneCh: make(chan struct{}, 1), } d.start() @@ -150,7 +155,8 @@ func (d *ddl) Start() error { func (d *ddl) start() { d.quitCh = make(chan struct{}) - d.wait.Add(1) + d.wait.Add(2) + go d.onExecute() go d.onWorker() // for every start, we will send a fake job to let worker // check owner first and try to find whether a job exists and run. diff --git a/ddl/table.go b/ddl/table.go index 7a09ce6ae7..b8c143e760 100644 --- a/ddl/table.go +++ b/ddl/table.go @@ -137,7 +137,7 @@ func (d *ddl) onDropTable(t *meta.Meta, job *model.Job) error { return errors.Trace(err) } - // all reorganization jobs done, drop this database + // all reorganization jobs done, drop this table. if err = t.DropTable(schemaID, tableID); err != nil { return errors.Trace(err) }