code: func finishTransaction(ctx context.Context, exec sqlexec.SQLExecutor, err error) error {
  	if err == nil {
  		_, err = exec.Execute(ctx, "commit")
  	} else {
  		_, err1 := exec.Execute(ctx, "rollback")
  		terror.Log(errors.Trace(err1))
  	}
  	return errors.Trace(err)
  }
docs: // finishTransaction will execute `commit` when error is nil, otherwise `rollback`.