This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new c8a3c112a7 Retry transactions on occasional deadlocks for rendered 
fields (#32341)
c8a3c112a7 is described below

commit c8a3c112a7bae345d37bb8b90d68c8d6ff2ef8fc
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed Jul 5 13:28:16 2023 +0200

    Retry transactions on occasional deadlocks for rendered fields (#32341)
    
    This is a follow-up on #18616 where we introduced retries on the
    occassional deadlocks when rendered task fields have been deleted
    by parallel threads (this is not a real deadlock, it's because
    MySQL locks too many things when queries are executed and will
    deadlock when one of those queries wait too much).
    
    Adding retry - while not perfect - should allow to handle the
    problem and significantly decrease the likelihood of such
    deadlocks.
    
    We can probably think about different approach for rendered fields,
    but for now retrying is - I think - acceptable short-term fix.
    
    Fixes: #32294
    Fixes: #29687
---
 airflow/models/renderedtifields.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/airflow/models/renderedtifields.py 
b/airflow/models/renderedtifields.py
index 8cea81715f..9586834470 100644
--- a/airflow/models/renderedtifields.py
+++ b/airflow/models/renderedtifields.py
@@ -175,6 +175,7 @@ class RenderedTaskInstanceFields(Base):
         return result.k8s_pod_yaml if result else None
 
     @provide_session
+    @retry_db_transaction
     def write(self, session: Session = None):
         """Write instance to database.
 

Reply via email to