ahnazary opened a new pull request, #77598: URL: https://github.com/apache/airflow/pull/77598
Since 3.4.0, `rtif_v2` is keyed only by the attempt UUID and every retry is its own `task_instance` row. The cleanup that runs after each task execution matched every run outside the retained ones, so it read all attempts the task ever had to delete about one row. On busy deployments it became the top database statement and stalled the API server. The cleanup now only clears the `num_dag_runs_to_retain_rendered_fields` runs just past the retained ones, so its cost no longer grows with the task's history. Rows from older runs are left to `airflow db clean`, which removes them through the `task_instance` foreign key. No schema change, so it can be backported to 3.4.x. Tested `test_renderedtifields.py` and `test_task_data.py` with Breeze on Postgres and MySQL. related: https://github.com/apache/airflow/issues/77237 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Claude Code (Claude Opus 5.5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
