You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/06/09 07:18:20 UTC

[GitHub] [dolphinscheduler] baoyingcong opened a new issue, #10381: 2.0.5版本,新建任务,多次点击保存t_ds_process_definition_log会生成多条一样的任务,导致工作流定义异常

baoyingcong opened a new issue, #10381:
URL: https://github.com/apache/dolphinscheduler/issues/10381

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   2.0.5版本,新建任务,多次点击保存t_ds_process_definition_log会生成多条一样的任务,导致工作流定义异常。
   因为保存的任务并没有把tast的code返回前端,更新前端的json,多次提交的json,task会被识别成一个新的任务保存到mysql里面去,这样就存了多条数据
   
   ### What you expected to happen
   
   期望新建任务,多次点击保存,t_ds_process_definition_log 不会保存这条数据
   
   ### How to reproduce
   
   2种解决方案,
   一、是将保存以后生成的taskId和version返回前端,下次点击保存,会携带这部分信息
   二、修改 ProcessService.class 的saveTaskDefine,把先把version改为1,不要那version=0去数据库里面判断是否需要更新,这样是不会查到任何数据的,我们先置version为1,再去数据库里面查这条信息是否存在,如果存在那么就只更新,不新增,代码如下
   ```
               if (taskDefinitionLog.getVersion() <= 0){
                   taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
               }
               if (taskDefinitionLog.getCode() > 0) {
                   TaskDefinitionLog definitionCodeAndVersion = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskDefinitionLog.getCode(), taskDefinitionLog.getVersion());
                   if (definitionCodeAndVersion != null) {
                       if (!taskDefinitionLog.equals(definitionCodeAndVersion)) {
                           taskDefinitionLog.setUserId(definitionCodeAndVersion.getUserId());
                           Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionLog.getCode());
                           taskDefinitionLog.setVersion(version + 1);
                           taskDefinitionLog.setCreateTime(definitionCodeAndVersion.getCreateTime());
                           updateTaskDefinitionLogs.add(taskDefinitionLog);
                       }
                       continue;
                   }
               }
   ```
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   2.0.5
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] SbloodyS closed issue #10381: In version 2.0.5, creating a new task and clicking to save t_ds_process_definition_log multiple times will generate multiple identical tasks, resulting in abnormal workflow definition

Posted by GitBox <gi...@apache.org>.
SbloodyS closed issue #10381: In version 2.0.5, creating a new task and clicking to save t_ds_process_definition_log multiple times will generate multiple identical tasks, resulting in abnormal workflow definition
URL: https://github.com/apache/dolphinscheduler/issues/10381


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] SbloodyS commented on issue #10381: In version 2.0.5, creating a new task and clicking to save t_ds_process_definition_log multiple times will generate multiple identical tasks, resulting in abnormal workflow definition

Posted by GitBox <gi...@apache.org>.
SbloodyS commented on issue #10381:
URL: https://github.com/apache/dolphinscheduler/issues/10381#issuecomment-1150781000

   This issue has been fixed in #8989. I'll close this issue.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #10381: In version 2.0.5, creating a new task and clicking to save t_ds_process_definition_log multiple times will generate multiple identical tasks, resulting in abnormal workflow definition

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #10381:
URL: https://github.com/apache/dolphinscheduler/issues/10381#issuecomment-1150770094

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   In version 2.0.5, creating a new task and clicking to save t_ds_process_definition_log multiple times will generate multiple identical tasks, resulting in an abnormal workflow definition.
   Because the saved task does not return the tast code to the front-end, update the front-end json, and submit the json multiple times, the task will be recognized as a new task and saved in mysql, thus saving multiple pieces of data
   
   ### What you expected to happen
   
   Expect to create a new task, click save multiple times, t_ds_process_definition_log will not save this data
   
   ### How to reproduce
   
   2 solutions,
   One is to return the taskId and version generated after saving to the front end, and the next time you click save, this part of the information will be carried
   Second, modify the saveTaskDefine of ProcessService.class, change the version to 1 first, do not go to the database with version=0 to determine whether it needs to be updated, so that no data will be found, we first set the version to 1, and then go to the database Check whether this information exists in it. If it exists, it will only be updated, not added. The code is as follows
   ````
               if (taskDefinitionLog.getVersion() <= 0){
                   taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
               }
               if (taskDefinitionLog.getCode() > 0) {
                   TaskDefinitionLog definitionCodeAndVersion = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskDefinitionLog.getCode(), taskDefinitionLog.getVersion());
                   if (definitionCodeAndVersion != null) {
                       if (!taskDefinitionLog.equals(definitionCodeAndVersion)) {
                           taskDefinitionLog.setUserId(definitionCodeAndVersion.getUserId());
                           Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionLog.getCode());
                           taskDefinitionLog.setVersion(version + 1);
                           taskDefinitionLog.setCreateTime(definitionCodeAndVersion.getCreateTime());
                           updateTaskDefinitionLogs.add(taskDefinitionLog);
                       }
                       continue;
                   }
               }
   ````
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   2.0.5
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [dolphinscheduler] github-actions[bot] commented on issue #10381: In version 2.0.5, creating a new task and clicking to save t_ds_process_definition_log multiple times will generate multiple identical tasks, resulting in abnormal workflow definition

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #10381:
URL: https://github.com/apache/dolphinscheduler/issues/10381#issuecomment-1150770284

   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 [join our slack](https://s.apache.org/dolphinscheduler-slack) and send your question to channel `#troubleshooting`


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org