hussein-awala opened a new pull request, #76034: URL: https://github.com/apache/airflow/pull/76034
Concurrent tasks emitting the same new asset through an `AssetAlias` can both find the target missing and race to insert it. The losing task-completion request then fails the task and rolls back its event writes, even though the task's Python code succeeded. Create the target inside a savepoint and reuse the winning `(name, uri)` asset after an insertion conflict. This preserves earlier event writes and the winner's metadata. Unrelated integrity errors still propagate. Start the savepoint outside conflict recovery so failures flushing earlier caller changes cannot be mistaken for this race. This follows the existing patterns in `DynamicRegion.get_or_create` and `AssetManager._get_or_create_apdr`. Two database-backed regressions exercise a real concurrent insertion conflict and an unrelated primary-key conflict. The concurrent case verifies one asset, both producers' alias events, and both earlier concrete outlet events. Both regressions fail without the fix. Validation: - Focused asset tests: 19 passed and one backend-specific skip on each of PostgreSQL, MySQL, and SQLite. Both new regressions also passed on PostgreSQL and MySQL after rebasing onto current `main`. - Full line and branch coverage of the new recovery block. - API database suite: 4,516 passed, 12 skipped. API non-database suite: 953 passed. - Always database suite: 1,996 passed, 3 skipped. - Regular and applicable manual static checks passed. - Remaining selected core suites and the documentation build were not run locally; CI validation is pending. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Codex (GPT-6) Generated-by: Codex (GPT-6) following the [contribution guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions). --- Drafted-by: Codex (GPT-6) (no human review 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]
