dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Bug] [dolphinscheduler-api] switchVersion(User loginUser, long projectCode, long taskCode, int version) always throw switch task definition version error

Open zwZjut opened this issue 5 years ago • 2 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

What happened

int switchVersion = taskDefinitionMapper.updateById(taskDefinitionLog); // t_ds_task_definition_log id is different from t_ds_task_definition id , we may add taskDefinitionLog.setId(taskDefinition.getId()) @Override public Map<String, Object> switchVersion(User loginUser, long projectCode, long taskCode, int version) { Project project = projectMapper.queryByCode(projectCode); //check user access for project Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (processService.isTaskOnline(taskCode)) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); return result; } TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version); taskDefinitionLog.setUserId(loginUser.getId()); taskDefinitionLog.setUpdateTime(new Date()); int switchVersion = taskDefinitionMapper.updateById(taskDefinitionLog); if (switchVersion > 0) { result.put(Constants.DATA_LIST, taskCode); putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.SWITCH_TASK_DEFINITION_VERSION_ERROR); } return result; }

What you expected to happen

switchVersion success

How to reproduce

call switchTaskDefinitionVersion openapi you will find "switch task definition version error"

Anything else

No response

Are you willing to submit PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

zwZjut avatar Nov 11 '21 02:11 zwZjut

Hi:

  • Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
  • In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
  • If you haven't received a reply for a long time, you can subscribe to the developer's email,Mail subscription steps reference https://dolphinscheduler.apache.org/en-us/community/development/subscribe.html ,Then write the issue URL in the email content and send question to [email protected].

github-actions[bot] avatar Nov 11 '21 02:11 github-actions[bot]

fixd #6784

CalvinKirs avatar Nov 30 '21 07:11 CalvinKirs