Skip to content

Avoid row locks for queued executor events#67043

Open
dsherniiazov wants to merge 2 commits into
apache:mainfrom
dsherniiazov:codex/fix-66794-queued-events-lock
Open

Avoid row locks for queued executor events#67043
dsherniiazov wants to merge 2 commits into
apache:mainfrom
dsherniiazov:codex/fix-66794-queued-events-lock

Conversation

@dsherniiazov
Copy link
Copy Markdown

closes: #66794

Queued executor events only need to persist external_executor_id, so they should not go through the scheduler path that locks task instance rows with FOR UPDATE SKIP LOCKED.

This change processes QUEUED executor events with a direct UPDATE, while keeping RUNNING, SUCCESS, FAILED, and RESTARTING events on the existing locked path.

Added regression coverage for:

  • queued-only executor events updating external_executor_id without row locks
  • mixed queued and failed executor events where only the failed event uses the locked path

Tests:

  • uv run --package apache-airflow-core ruff check airflow-core/src/airflow/jobs/scheduler_job_runner.py airflow-core/tests/unit/jobs/test_scheduler_job.py
  • uv run --package apache-airflow-core ruff format --check airflow-core/src/airflow/jobs/scheduler_job_runner.py airflow-core/tests/unit/jobs/test_scheduler_job.py
  • uv run --package apache-airflow-core pytest airflow-core/tests/unit/jobs/test_scheduler_job.py -q -k "process_executor_events_queued_updates_without_row_lock or process_executor_events_mixed_queued_and_failed_locks_only_failed or test_process_executor_events or test_process_executor_events_with_no_callback or test_process_executor_events_ti_requeued or test_process_executor_events_multiple_try_numbers_warns"

@dsherniiazov dsherniiazov requested review from XD-DENG and ashb as code owners May 16, 2026 18:21
@boring-cyborg boring-cyborg Bot added the area:Scheduler including HA (high availability) scheduler label May 16, 2026
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented May 16, 2026

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@dsherniiazov dsherniiazov force-pushed the codex/fix-66794-queued-events-lock branch from 735cd73 to f60111e Compare May 18, 2026 12:19
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler: drop FOR UPDATE on QUEUED executor events to avoid heartbeat deadlock

2 participants