code: func (d *ddl) addDDLJob(ctx sessionctx.Context, job *model.Job) error {
  	startTime := time.Now()
  	job.Version = currentVersion
  	job.Query, _ = ctx.Value(sessionctx.QueryString).(string)
  	err := kv.RunInNewTxn(d.store, true, func(txn kv.Transaction) error {
  		t := newMetaWithQueueTp(txn, job.Type.String())
  		var err error
  		job.ID, err = t.GenGlobalID()
  		if err != nil {
  			return errors.Trace(err)
  		}
  		job.StartTS = txn.StartTS()
  		if err = buildJobDependence(t, job); err != nil {
  			return errors.Trace(err)
  		}
  		err = t.EnQueueDDLJob(job)
  
  		return errors.Trace(err)
  	})
  	metrics.DDLWorkerHistogram.WithLabelValues(metrics.WorkerAddDDLJob, job.Type.String(), metrics.RetLabel(err)).Observe(time.Since(startTime).Seconds())
  	return errors.Trace(err)
  }
docs: // addDDLJob gets a global job ID and puts the DDL job in the DDL queue.