dheerajturaga commented on code in PR #73763:
URL: https://github.com/apache/airflow/pull/73763#discussion_r4166672178


##########
airflow-core/src/airflow/models/backfill.py:
##########
@@ -711,6 +712,9 @@ def _create_backfill(
 
         first_info = dagrun_info_list[0]
         try:
+            if drain_dag:
+                # After the backfill row's commit, so the drain commits or 
rolls back with the runs.
+                DagModel.start_drain(dag_id, session=session)

Review Comment:
   Moved `start_drain` after both `_create_runs_*` paths, inside the same `try` 
and transaction. Tests verify another session can lock the Dag row after the 
inserts and before draining begins on PostgreSQL and MySQL. A separate 
regression checks cleanup when the later drain lock fails.
   
   ---
   Drafted-by: Codex (GPT-6); reviewed by @dheerajturaga 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