kjh0623 commented on issue #70056:
URL: https://github.com/apache/airflow/issues/70056#issuecomment-6166927309

   Closing this as resolved by #71696 (released in 3.3.2).
   
   `DBDagBag._version_from_dag_run` now falls back to the latest Dag version 
when `created_dag_version_id` is missing, even if `bundle_version` is set:
   
   ```python
   if not dag_run.bundle_version or not dag_run.created_dag_version_id:
   ```
   
   So a queued run whose pinned version was deleted now resolves to the latest 
version and starts, instead of being skipped on every scheduler loop. That's 
option 2 from the issue description. As @kaxil noted when closing #70113, 
failing the run explicitly (option 1) isn't the preferred direction.
   
   If you're on a version before 3.3.2, this query finds runs stuck in this 
state:
   
   ```sql
   SELECT dag_id, run_id, bundle_version
   FROM dag_run
   WHERE state = 'queued'
     AND bundle_version IS NOT NULL
     AND created_dag_version_id IS NULL;
   ```
   
   Clearing those runs, or upgrading to 3.3.2+, gets them moving again.
   
   Changing the `dag_run.created_dag_version_id` FK from `SET NULL` to 
`RESTRICT` (discussed in #70072) would be a separate hardening change. It isn't 
needed to fix this bug.
   


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