zwZjut commented on a change in pull request #6784:
URL: https://github.com/apache/dolphinscheduler/pull/6784#discussion_r747226887



##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
##########
@@ -288,10 +288,11 @@
             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);
+        TaskDefinitionLog taskDefinitionUpdate = 
taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version);
+        taskDefinitionUpdate.setUserId(loginUser.getId());
+        taskDefinitionUpdate.setUpdateTime(new Date());
+        taskDefinitionUpdate.setId(taskDefinition.getId());

Review comment:
       in my opinion ,  switchVersion is to set  the version  of   
t_ds_task_definition  , which reference from   t_ds_task_definition_log,   
let's see the metadata,  version=6  id=8  in t_ds_task_definition, but 
version=6 id=22 in t_ds_task_definition_log,   
taskDefinitionMapper.updateById(t_ds_task_definition_log)  will  throw "Switch 
task definition version error" because  id=22 not in t_ds_task_definition,  or 
maybe I am wrong, but the problem I got when  I call  openapi  
"switchTaskDefinitionVersion" 
   
![image](https://user-images.githubusercontent.com/13324943/141246118-994d61aa-e3d4-45ae-b17e-903c55fa6b38.png)
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to