github-actions[bot] commented on issue #12872:
URL: 
https://github.com/apache/dolphinscheduler/issues/12872#issuecomment-1311632887

   ### 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 the workflow version information record, the workflow save operation with 
no content change will be recorded, and a version information will also be 
recorded. It is found in the source code that the developer has intentionally 
filtered out the unmodified save operation, but it does not actually work.
   
   ### What you expected to happen
   
   Normally, workflows are saved without modification, and there should be no 
need to record version information.
   
   ### How to reproduce
   
   <img width="1219" alt="iShot2022-11-11 19 37 19" 
src="https://user-images.githubusercontent.com/20608690/201332707-b075cf15-799a-4b67-bd64-5c61e578c68c.png";
 >
   Create a workflow and there will be a v1 version record.
   
   
   <img width="1386" alt="iShot2022-11-11 19 39 53" 
src="https://user-images.githubusercontent.com/20608690/201338847-78f74a97-3067-4237-8974-1361f5e4d9de.png";
 >
   Open the workflow again, and click Save without any modifications to the 
workflow
   
   <img width="1244" alt="iShot2022-11-11 19 41 10" 
src="https://user-images.githubusercontent.com/20608690/201338976-ee27590d-846c-4373-9bf7-6d264b15471d.png";
 >
   There will still be a version message logged.
   
   
   
   
   ### Anything else
   
   # After researching the source code, I found the reason and provided a 
reference
   
   <img width="1199" alt="iShot2022-11-11 19 50 42" 
src="https://user-images.githubusercontent.com/20608690/201334747-01d58d22-7692-4da8-848b-ef0032aadc31.png";
 >
   It can be seen from this part of the code that the original intention is to 
filter the save operation without modification.
   <img width="1184" alt="iShot2022-11-11 19 53 58" 
src="https://user-images.githubusercontent.com/20608690/201335227-a2de2749-af57-4dd2-a04e-319b39524331.png";
 >
   But in this step, even if there is no operation to save, the isChange here 
will be true, because there is a problem with removeAll.
   
   <img width="1372" alt="iShot2022-11-11 19 57 13" 
src="https://user-images.githubusercontent.com/20608690/201336064-9910432c-0caa-41a4-a62b-0f202aa8d5d9.png";
 >
   It can be seen that ProcessTaskRelationLog overwrites the hashCode method by 
calling the hashCode of ProcessTaskRelation, and the hashCode takes the hash 
value for the parameters such as name, processDefinitionVersion, projectCode, 
processDefinitionCode, preTaskCode, preTaskVersion, postTaskCode, 
postTaskVersion.
   <img width="1237" alt="iShot2022-11-11 20 04 07" 
src="https://user-images.githubusercontent.com/20608690/201336830-bd537993-395e-4c21-8731-b7d4f5d675d5.png";
 >
   
   In fact, the taskDefinitionJson transmitted by the front-end does not 
contain processDefinitionVersion, projectCode, processDefinitionCode. These are 
three parameters. The removeAll error has been mistaken for isChange, and 
eventually there will be version records for no modification operations.
   
   
   # Solution
   The front end can bring those three parameters, and it will be fine. The 
version information will not be recorded after the next save without 
modification.
   
   ### Version
   
   2.0.x
   
   ### 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]

Reply via email to