potiuk commented on PR #60166:
URL: https://github.com/apache/airflow/pull/60166#issuecomment-3717943492

   That's a very plausible explanation. Actually all deadlocks are caused by 
two resources that attempt to be locked in reverse sequence and it seems that's 
exactly what might happen here. The issue here is that you have two locks 
(shared for query and exclusive for delete) - and they are both attempted to be 
acquired in a single transaction -  - so indeed if there is another query that 
attempts to acquire an exclusive lock while the shared lock is already acquired 
by the query - and then attempts to acquire the shared lock - those two queries 
will deadlock.
   
   Separating it into two queries has the effect that there is only one lock 
acquired per query - and immediately released after the query completes, so 
there is basically no chance for deadlock.
   
   I don't even think we need some tests for it - this is not an easy one to 
test and has very little value, once we add the comment.
   
   


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