Skip to content

Conversation

@kaxil
Copy link
Member

@kaxil kaxil commented Oct 22, 2025

When a user changed only the case of a DAG tag (e.g., 'dangerous' to 'DANGEROUS'), the dag-processor would crash with a duplicate key error on MySQL due to case-insensitive collation in the PRIMARY KEY. This occurred because SQLAlchemy executed INSERT operations before DELETE operations during the flush.

The fix ensures DELETE operations complete before attempting INSERT operations by explicitly flushing and refreshing the tag relationship from the database.

Fixes #56940


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@kaxil kaxil force-pushed the tags-case branch 2 times, most recently from fa266a9 to 0492f57 Compare October 23, 2025 16:43
When a user changed only the case of a DAG tag (e.g., 'dangerous' to
'DANGEROUS'), the dag-processor would crash with a duplicate key error
on MySQL due to case-insensitive collation in the PRIMARY KEY. This
occurred because SQLAlchemy executed INSERT operations before DELETE
operations during the flush.

The fix ensures DELETE operations complete before attempting INSERT
operations by explicitly flushing and refreshing the tag relationship
from the database.

Fixes apache#56940
@kaxil kaxil added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Oct 23, 2025
@kaxil kaxil merged commit 5013aad into apache:main Oct 23, 2025
60 checks passed
@kaxil kaxil deleted the tags-case branch October 23, 2025 19:36
github-actions bot pushed a commit that referenced this pull request Oct 23, 2025
…QL (#57113)

When a user changed only the case of a DAG tag (e.g., 'dangerous' to
'DANGEROUS'), the dag-processor would crash with a duplicate key error
on MySQL due to case-insensitive collation in the PRIMARY KEY. This
occurred because SQLAlchemy executed INSERT operations before DELETE
operations during the flush.

The fix ensures DELETE operations complete before attempting INSERT
operations by explicitly flushing and refreshing the tag relationship
from the database.

Fixes #56940
(cherry picked from commit 5013aad)

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
@github-actions
Copy link

Backport successfully created: v3-1-test

Status Branch Result
v3-1-test PR Link

github-actions bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Oct 23, 2025
…QL (apache#57113)

When a user changed only the case of a DAG tag (e.g., 'dangerous' to
'DANGEROUS'), the dag-processor would crash with a duplicate key error
on MySQL due to case-insensitive collation in the PRIMARY KEY. This
occurred because SQLAlchemy executed INSERT operations before DELETE
operations during the flush.

The fix ensures DELETE operations complete before attempting INSERT
operations by explicitly flushing and refreshing the tag relationship
from the database.

Fixes apache#56940
(cherry picked from commit 5013aad)

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
potiuk pushed a commit that referenced this pull request Oct 25, 2025
…QL (#57113)

When a user changed only the case of a DAG tag (e.g., 'dangerous' to
'DANGEROUS'), the dag-processor would crash with a duplicate key error
on MySQL due to case-insensitive collation in the PRIMARY KEY. This
occurred because SQLAlchemy executed INSERT operations before DELETE
operations during the flush.

The fix ensures DELETE operations complete before attempting INSERT
operations by explicitly flushing and refreshing the tag relationship
from the database.

Fixes #56940
(cherry picked from commit 5013aad)

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
kaxil added a commit that referenced this pull request Oct 31, 2025
When a user changed only the case of a DAG tag (e.g., 'dangerous' to
'DANGEROUS'), the dag-processor would crash with a duplicate key error
on MySQL due to case-insensitive collation in the PRIMARY KEY. This
occurred because SQLAlchemy executed INSERT operations before DELETE
operations during the flush.

The fix ensures DELETE operations complete before attempting INSERT
operations by explicitly flushing and refreshing the tag relationship
from the database.

Fixes #56940

(cherry picked from commit 5013aad)
kaxil added a commit that referenced this pull request Oct 31, 2025
When a user changed only the case of a DAG tag (e.g., 'dangerous' to
'DANGEROUS'), the dag-processor would crash with a duplicate key error
on MySQL due to case-insensitive collation in the PRIMARY KEY. This
occurred because SQLAlchemy executed INSERT operations before DELETE
operations during the flush.

The fix ensures DELETE operations complete before attempting INSERT
operations by explicitly flushing and refreshing the tag relationship
from the database.

Fixes #56940

(cherry picked from commit 5013aad)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:DAG-processing backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dag Tag renaming (from lower case to upper case) cause dag-processor failure

2 participants