Example #1
0
// prepareBgJob prepares a background job.
func (d *ddl) prepareBgJob(t *meta.Meta, ddlJob *model.Job) error {
	job := &model.Job{
		ID:       ddlJob.ID,
		SchemaID: ddlJob.SchemaID,
		TableID:  ddlJob.TableID,
		Type:     ddlJob.Type,
		Args:     ddlJob.Args,
	}
	err := t.EnQueueBgJob(job)
	return errors.Trace(err)
}
Example #2
0
// prepareBgJob prepares a background job.
func (d *ddl) prepareBgJob(t *meta.Meta, ddlJob *model.Job) error {
	job := &model.Job{
		ID:       ddlJob.ID,
		SchemaID: ddlJob.SchemaID,
		TableID:  ddlJob.TableID,
		Type:     ddlJob.Type,
	}

	if len(ddlJob.Args) >= 2 {
		// ddlJob.Args[0] is the schema version that isn't necessary in background job and
		// ddlJob.Args[1] is the table information or the database information.
		// They will make the background job of dropping schema become more complicated to handle.
		job.Args = ddlJob.Args[2:]
	}

	err := t.EnQueueBgJob(job)
	return errors.Trace(err)
}