github-actions[bot] commented on issue #11942: URL: https://github.com/apache/dolphinscheduler/issues/11942#issuecomment-1247076771
### 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 As the issue title said,steps as list: 1. Define a Workflow and run it , then i got a Workflow Instance   2. Edit the Workflow Instance then saving it without selecting 'update definition' check-box .  3. Return to the Workflow Definition UI , i got a error  and i found an NPE in the backend logs  The direct cause is **THE VAR `processDefinitionLog` IS NULL**  4. i check records in the meta-database(mysql style) and find that records accidentally lost in table `t_ds_process_definition_log` There should be two records, their `version` column values are 1 and 2 respectively (直接原因是t_ds_process_definition_log表丢失了一条version列值为1的记录)  ### What you expected to happen No exception occurred ### How to reproduce The steps are listed in the paragraph **What happened** above ### Anything else I analysis the codes and i think the root is in method `org.apache.dolphinscheduler.service.process.ProcessServiceImpl#saveProcessDefine`: it query the `log obj` which according to the `ID` of the `definition obj` , then updating the `log obj` to set a new `version` . The `t_ds_process_definition_log` table should keeps all records of definition's changes and the record should not be overwritten or updated, which may be against the design (根本原因是更新工作流实例时,根据工作流定义的ID查找了 `LOG 对象` 并修改了 `version值` , Log表应该保留所有定义变更的历史记录,不应该把version=1的记录更新掉。况且用定义对象的ID去查询更新LOG对象就不对。)  ### Version dev ### Are you willing to submit PR? - [X] 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
