code: func buildJobDependence(t *meta.Meta, curJob *model.Job) error {
  	// Jobs in the same queue are ordered. If we want to find a job's dependency-job, we need to look for
  	// it from the other queue. So if the job is "ActionAddIndex" job, we need find its dependency-job from DefaultJobList.
  	var jobs []*model.Job
  	var err error
  	switch curJob.Type {
  	case model.ActionAddIndex:
  		jobs, err = t.GetAllDDLJobsInQueue(meta.DefaultJobListKey)
  	default:
  		jobs, err = t.GetAllDDLJobsInQueue(meta.AddIndexJobListKey)
  	}
  	if err != nil {
  		return errors.Trace(err)
  	}
  
  	for _, job := range jobs {
  		if curJob.ID < job.ID {
  			continue
  		}
  		isDependent, err := curJob.IsDependentOn(job)
  		if err != nil {
  			return errors.Trace(err)
  		}
  		if isDependent {
  			logutil.Logger(ddlLogCtx).Info("[ddl] current DDL job depends on other job", zap.String("currentJob", curJob.String()), zap.String("dependentJob", job.String()))
  			curJob.DependencyID = job.ID
  			break
  		}
  	}
  	return nil
  }
docs: // buildJobDependence sets the curjob's dependency-ID.
  // The dependency-job's ID must less than the current job's ID, and we need the largest one in the list.