dolphinscheduler
dolphinscheduler copied to clipboard
[Improvement-16979] Unify PriorityDelayQueue with AbstractDelayEventBus
Purpose of the pull request
implement #16979
Brief change log
-
Refactored
DelayEntry.java,PriorityDelayQueue,PriorityAndDelayBasedTaskEntry,TimeBasedTaskExecutionRunnableComparableEntrywithTaskDispatchEntryEvent,TaskDispatchEntryEventBuswhich inherited fromAbstractDelayEventBus,AbstractDelayEvent -
Fix
PriorityAndDelayBasedTaskEntry's compare issue, old object compare task priority after compare time in millisecond, cause the task priority only affect in same millisecond, now it will compare task priority first, then the create time.
Verify this pull request
the test codes were refactored.
Pull Request Notice
If your pull request contains incompatible change, you should also add it to docs/docs/en/guide/upgrade/incompatible.md
Good job, after this PR merged, the master code will be clearer.
Base on this, we can provide more EventBus to expose the workflow instance/task instance lifecycle event to exposed to outside.
Can we remove
GlobalTaskDispatchWaitingQueueandGlobalTaskDispatchWaitingQueueLooper, this queue is used to handle the delay time, but bring some extra problems, e.g. there are existing many thread to deal with the task lifecycle in master, we need to do extra concurrency control, e.g. one task is in dispatching, and then receive a kill event.Since
TaskDispatchLifecycleEventis already anDelayEventso we can directly set the delay time to it, then we can removedTimeBasedTaskExecutionRunnableComparableEntryandWorkerGroupTaskDispatcher. We directly useITaskExecutorClientto dispatch task indispatchEventAction, if dispatch failed then regenerate aTaskDispatchLifecycleEventwith retry delay time.
i'll have a try.
@reele Sorry, I miss something, we need to sort the tasks by priority under one worker group, so WorkerGroupTaskDispatcher cannot be removed, but GlobalTaskDispatchWaitingQueue and GlobalTaskDispatchWaitingQueueLooper can be removed.
@reele Sorry, I miss something, we need to sort the tasks by priority under one worker group, so
WorkerGroupTaskDispatchercannot be removed, butGlobalTaskDispatchWaitingQueueandGlobalTaskDispatchWaitingQueueLoopercan be removed.
OK.
@reele Sorry, I miss something, we need to sort the tasks by priority under one worker group, so
WorkerGroupTaskDispatchercannot be removed, butGlobalTaskDispatchWaitingQueueandGlobalTaskDispatchWaitingQueueLoopercan be removed.OK.
I'll figure out how to fix this prioritization problem, which is in fact very inaccurate, and it's not sorting globally.
I have removed GlobalTaskDispatchWaitingQueue at #17180
I have removed
GlobalTaskDispatchWaitingQueueat #17180
Oh! sorry for not solving this pr in time......
I have removed
GlobalTaskDispatchWaitingQueueat #17180Oh! sorry for not solving this pr in time......
Hi @reele, I reopen this PR, this PR still needed.
@ruanwenjun recommitted.
Quality Gate passed
Issues
9 New issues
0 Accepted issues
Measures
0 Security Hotspots
78.1% Coverage on New Code
0.0% Duplication on New Code