FrankYang0529 commented on PR #72057:
URL: https://github.com/apache/airflow/pull/72057#issuecomment-5707281702

   Thanks for the review. Good catch.
   
   Updated it to follow the same policy as 
`BaseExecutor._get_workloads_to_schedule()`: callbacks first in queue order, 
then tasks by `priority_weight`.
   
   I did not use a single `ORDER BY` with a callback-first `CASE` key. No index 
covers that key, so the planner stops using `rj_order`. `fetch()` runs two 
queries. The first fetches callbacks (`dag_id == EXECUTE_CALLBACK_TAG`, ordered 
by `queued_dttm`, served by the primary key prefix). The second runs only if 
the first comes back empty. It fetches tasks (ordered by `priority_weight DESC, 
queued_dttm`, served by `rj_order`).


-- 
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