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

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar feature requirement.
   
   
   ### Description
   
   This is an extended issue for #16768 and #16776 to solve the ​scheduling 
time dependency​ issue.
   
   The main problem is that dependent tasks query `WorkflowInstance` by 
`scheduleTime`, but sub-workflows do not have this value.
   
   Recursively finding the main workflow is not a good approach, and iterating 
through all levels of sub-workflows from the main workflow is also 
inefficient—both may cause database performance issues.
   
   Therefore, there should always be a ​key or value​ to directly determine the 
time and start action that workflows have.
   
   For this reason, I propose creating a new object called `Action` to record 
the original workflow start information.
   
   ```mermaid
   erDiagram
     "[*Action]" {
       int id
       enum actionType
       date submittedTime
     }
     "WorkflowInstance" {
       int actionId FK
     }
     "TaskInstance" {
       int workflowInstanceId FK
     }
   
     "WorkflowInstance" }|--|| "[*Action]" : ""
     "TaskInstance" }|--|| "WorkflowInstance" : ""
   ```
   
   Use `Action` addresses two issues:
   1. Reducing database pressure: The dependent node first filters actions by 
submittedTime, then queries workflow-instances using (testFlag, code, 
actionId). This reduces table scans and optimizes index usage (previously on 
testFlag, code, scheduleTime/startTime).
   2. Fixing dependency logic: Prevents null scheduleTime comparisons (in 
manual schedules), making the behavior more robust.
   
   With the action object, the dependent node now query tasks always based on a 
fixed timestamp, not the node task's real `startTime`.
   
   ### Are you willing to submit a 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