safaehar opened a new pull request, #74455:
URL: https://github.com/apache/airflow/pull/74455

   `airflow db clean` checks whether each batch contains rows before creating 
its archive table and deleting the batch. The result is used only as a boolean, 
but the current query counts every matching row up to the configured batch size.
   
   This changes the per-batch probe from `COUNT(*)` to `EXISTS`, allowing the 
database to stop after the first matching row. The batch selection, archive 
behavior, transaction boundaries, and initial exact count used for dry-run and 
progress output remain unchanged.
   
   ## Tests
   
   - `uv run --project airflow-core pytest 
airflow-core/tests/unit/utils/test_db_cleanup.py::TestDBCleanup::test_do_delete_checks_batch_existence_without_counting_rows
 --with-db-init -xvs` (passed)
   - `uv run --project airflow-core pytest 
airflow-core/tests/unit/utils/test_db_cleanup.py --with-db-init -xq` (SQLite: 
113 passed, 3 backend-specific skipped)
   - `prek run --from-ref upstream/main --stage pre-commit` (passed)
   - `prek run --from-ref upstream/main --stage manual --skip 
compile-ui-assets-dev --skip view-skill-eval --skip run-skill-eval-codex` 
(passed)
   - `breeze verify` completed; its DB, non-DB, and docs commands could not 
start because the local Docker daemon was unavailable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (Codex)
   
   Generated-by: Codex following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   
   ---
   Drafted-by: Codex (no human review before posting)
   


-- 
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]

Reply via email to