ferruzzi commented on issue #47398:
URL: https://github.com/apache/airflow/issues/47398#issuecomment-2718883497

   It looks like the code is commented indicating this is a known and 
intentional decision, along with a proposed solution that I don't understand 
yet.
   ```
   def _queue_dagruns(cls, dataset_id: int, dags_to_queue: set[DagModel], 
session: Session) -> None:
       # Possible race condition: if multiple dags or multiple (usually
       # mapped) tasks update the same dataset, this can fail with a unique
       # constraint violation.
       #
       # If we support it, use ON CONFLICT to do nothing, otherwise
       # "fallback" to running this in a nested transaction. This is needed
       # so that the adding of these rows happens in the same transaction
       # where `ti.state` is changed.
   ```
   
[https://github.com/apache/airflow/blob/2.10.5/airflow/datasets/manager.py#L167](https://github.com/apache/airflow/blob/2.10.5/airflow/datasets/manager.py#L167)
   
   Seems like we should be able to change the method to be
   ```
   while dags_to_queue:
       if session.bind.dialect.name == "postgresql":
           return cls._postgres_queue_dagruns(dataset_id, dags_to_queue, 
session)
       return cls._slow_path_queue_dagruns(dataset_id, dags_to_queue, session)
   return
   ```
   
   But I don't know.  If the solution was that easy it would have been done by 
now; it would have been faster to fix than to write that .
   
   There is [an 
email](https://lists.apache.org/thread/x6qxfzc7tlvfx4yfbkw6m3d9tr9swvwo) on the 
dev-list with instructions to try out  Airflow 3.0.0beta2, maybe you can use 
that to see if it has already been sorted out there?


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