vatsrahul1001 opened a new pull request, #77812: URL: https://github.com/apache/airflow/pull/77812
The triggerer's claim queries join task_instance and callback to order triggers by priority, and the row lock taken by those queries covered every table in the FROM clause. On PostgreSQL and MySQL 8 the triggerer therefore held locks on the joined task instance and callback rows until the claim committed. Scheduler writes to those rows, such as the trigger timeout sweep, had to wait for the triggerer, and SKIP LOCKED made the triggerer pass over any trigger whose task instance row the scheduler happened to hold, delaying that claim by a loop. The claim only arbitrates ownership through trigger.triggerer_id, so the trigger row is the only one that needs to be locked. Keeping the task instance rows out of the triggerer's lock set also removes the claim path from the scheduler/triggerer lock graph on task_instance. (cherry picked from commit 6196a32433a70e9d0da76644dfffdd47161a7420) Co-authored-by: Hussein Awala <[email protected]> --- Conflict in `airflow-core/tests/unit/models/test_trigger.py` import line only: kept the `v3-4-test` `sqlalchemy` import (no `text`, which only a main-only change uses) and added the `sqlalchemy.dialects` `mysql`/`postgresql` imports the new test needs. The source change in `models/trigger.py` applied cleanly. **Verified locally:** test_trigger.py (71 passed) and test_triggerer_job.py (142 passed, 1 skipped: needs a Postgres backend); ruff clean. The row-lock clause itself is asserted by the new dialect-compile tests, not exercised against a live Postgres/MySQL. Backport of #76213. Generated-by: Claude Code 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
