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

   closes: #68263
   
   ## Why
   
   `update_dag_parsing_results_in_db` retries database work via
   `run_with_db_retries`, which retries `DBAPIError` and `StaleDataError`.
   
   However, the local retry block only rolled back the session for
   `OperationalError`. If another retried DB error, such as `IntegrityError`,
   occurred during DAG metadata writes, the next retry could reuse a failed
   session and surface `PendingRollbackError`, hiding the original database
   failure.
   
   ## What
   
   - Roll back the session for `DBAPIError` and `StaleDataError`, matching the 
shared retry policy.
   - Add a regression test covering rollback before retrying `IntegrityError`.
   
   ## Tests
   
   - `git diff --check`
   - `python -m compileall -q 
airflow-core/src/airflow/dag_processing/collection.py 
airflow-core/tests/unit/dag_processing/test_collection.py`
   
   Focused pytest command prepared:
   
   ```bash
   PYTHONPATH=airflow-core/src:task-sdk/src:devel-common/src python -m pytest \
     
airflow-core/tests/unit/dag_processing/test_collection.py::TestUpdateDagParsingResults::test_sync_to_db_is_retried
 \
     
airflow-core/tests/unit/dag_processing/test_collection.py::TestUpdateDagParsingResults::test_sync_to_db_rolls_back_before_retrying_integrity_error
 -q
   ```
   
   Local pytest run was blocked by missing Airflow test/runtime dependencies in 
this environment.


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