BeauDevCode opened a new pull request, #68269: URL: https://github.com/apache/airflow/pull/68269
closes: #68243 ## Why `Trigger.clean_unused()` currently removes all unreferenced trigger rows in one unbounded delete. On busy deployments this can hold locks on the `trigger` table for the duration of a large cleanup and stall the triggerer loop. ## What changed - Select unused trigger IDs before deleting, preserving the existing unused-trigger criteria. - Delete matching trigger rows in configurable batches, committing between batches. - Add `[triggerer] unreferenced_triggers_cleanup_batch_size`, defaulting to `500`; setting it to `0` keeps single-transaction cleanup behavior. - Add a unit test that uses a batch size of `2` and verifies five unused triggers are removed across three committed delete batches. Related context: PR #68244 changes the anti-join shape in the same method, but does not add bounded delete batches. This PR intentionally focuses on the batching behavior requested in #68243. ## Tests - `git diff --check` - `python3 -m compileall -q airflow-core/src/airflow/models/trigger.py airflow-core/tests/unit/models/test_trigger.py` - Parsed `airflow-core/src/airflow/config_templates/config.yml` with PyYAML and verified the new option shape Not run locally: focused pytest/config validation could not complete because this environment lacks parts of Airflow's development dependency set (`pathspec` during test collection; `requests` for `dev/validate_version_added_fields_in_config.py`). -- 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]
