diff --git a/ddl/ddl_worker.go b/ddl/ddl_worker.go index 6afeea59937ff..4237a2f56c42b 100644 --- a/ddl/ddl_worker.go +++ b/ddl/ddl_worker.go @@ -510,7 +510,7 @@ func (w *worker) runDDLJob(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, default: // Invalid job, cancel it. job.State = model.JobStateCancelled - err = errInvalidDDLJob.GenWithStack("invalid ddl job %v", job) + err = errInvalidDDLJob.GenWithStack("invalid ddl job type: %v", job.Type) } // Save errors in job, so that others can know errors happened. diff --git a/ddl/ddl_worker_test.go b/ddl/ddl_worker_test.go index b6038bd5ce9ae..8aa62e5b684ba 100644 --- a/ddl/ddl_worker_test.go +++ b/ddl/ddl_worker_test.go @@ -136,6 +136,24 @@ func (s *testDDLSuite) TestTableError(c *C) { } +func (s *testDDLSuite) TestInvalidDDLJob(c *C) { + store := testCreateStore(c, "test_invalid_ddl_job_type_error") + defer store.Close() + d := testNewDDL(context.Background(), nil, store, nil, nil, testLease) + defer d.Stop() + ctx := testNewContext(d) + + job := &model.Job{ + SchemaID: 0, + TableID: 0, + Type: model.ActionNone, + BinlogInfo: &model.HistoryInfo{}, + Args: []interface{}{}, + } + err := d.doDDLJob(ctx, job) + c.Assert(err.Error(), Equals, "[ddl:3]invalid ddl job type: none") +} + func (s *testDDLSuite) TestForeignKeyError(c *C) { store := testCreateStore(c, "test_foreign_key_error") defer store.Close()