potiuk commented on code in PR #60166:
URL: https://github.com/apache/airflow/pull/60166#discussion_r2667606357
##########
airflow-core/src/airflow/models/asset.py:
##########
@@ -112,12 +112,14 @@ def remove_references_to_deleted_dags(session: Session):
DagScheduleAssetAliasReference,
TaskOutletAssetReference,
]
- for model in models_to_check:
- session.execute(
- delete(model)
-
.where(model.dag_id.in_(select(DagModel.dag_id).where(DagModel.is_stale)))
- .execution_options(synchronize_session="fetch")
- )
+
Review Comment:
```suggestion
# The queries need to be done in separate steps, because in case of multiple
dag processors on
# MySQL there could be a deadlock caused by acquiring both exclusive lock
for deletion and
# shared lock for query in reverse sequence
```
--
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]