The GitHub Actions job "Tests" on airflow.git/fix-ha-scheduler-race has failed. Run started by GitHub user kaxil (triggered by kaxil).
Head commit for run: 66ffb5a607af895c505ea0e692ea61a2e68198a1 / Ephraim Anierobi <[email protected]> Fix HA scheduler try_number double increment In HA, two scheduler processes can race to schedule the same TaskInstance. Previously DagRun.schedule_tis() updated rows by ti.id alone, so a scheduler could increment try_number and transition state even after another scheduler had already advanced the TI (e.g. to SCHEDULED/QUEUED), resulting in duplicate attempts being queued. This change makes scheduling idempotent under HA races by: - Guarding schedule_tis() DB updates to only apply when the TI is still in schedulable states (derived from SCHEDULEABLE_STATES, handling NULL explicitly). - Using a single CASE (next_try_number) so reschedules (UP_FOR_RESCHEDULE) do not start a new try, and applying this consistently to both normal scheduling and the EmptyOperator fast-path. The CASE uses TI.id (not TI.state) to avoid MySQL SET left-to-right evaluation issues. Adds regression tests covering: - TI already queued by another scheduler. - EmptyOperator fast-path blocked when TI is already QUEUED/RUNNING. - UP_FOR_RESCHEDULE scheduling keeps try_number unchanged. - Only one "scheduler" update succeeds when competing. Co-authored-by: Kaxil Naik <[email protected]> Report URL: https://github.com/apache/airflow/actions/runs/23279861754 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
