Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airflow db clean - Dag cleanup won't run if dag is tagged #23414

Closed
1 of 2 tasks
jrggggg opened this issue May 2, 2022 · 8 comments · Fixed by #23444
Closed
1 of 2 tasks

airflow db clean - Dag cleanup won't run if dag is tagged #23414

jrggggg opened this issue May 2, 2022 · 8 comments · Fixed by #23444
Assignees
Labels
area:core kind:bug This is a clearly a bug

Comments

@jrggggg
Copy link

jrggggg commented May 2, 2022

Apache Airflow version

2.3.0 (latest released)

What happened

When running airflow db clean, if a to-be-cleaned dag is also tagged, a foreign key constraint in dag_tag is violated. Full error:

sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "dag" violates foreign key constraint "dag_tag_dag_id_fkey" on table "dag_tag"
DETAIL:  Key (dag_id)=(some-dag-id-here) is still referenced from table "dag_tag".

What you think should happen instead

No response

How to reproduce

No response

Operating System

Debian GNU/Linux 11 (bullseye)

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==3.3.0
apache-airflow-providers-cncf-kubernetes==4.0.1
apache-airflow-providers-ftp==2.1.2
apache-airflow-providers-http==2.1.2
apache-airflow-providers-imap==2.2.3
apache-airflow-providers-microsoft-mssql==2.1.3
apache-airflow-providers-oracle==2.2.3
apache-airflow-providers-postgres==4.1.0
apache-airflow-providers-samba==3.0.4
apache-airflow-providers-slack==4.2.3
apache-airflow-providers-sqlite==2.1.3
apache-airflow-providers-ssh==2.4.3

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@jrggggg jrggggg added area:core kind:bug This is a clearly a bug labels May 2, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented May 2, 2022

Thanks for opening your first issue here! Be sure to follow the issue template!

@ephraimbuddy
Copy link
Contributor

Related: #23206

@nirutgupta
Copy link

I am seeing the same issue in 2.3.0
[2022-06-27, 12:27:29 UTC] {subprocess.py:92} INFO - sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "dag" violates foreign key constraint "dag_tag_dag_id_fkey" on table "dag_tag" [2022-06-27, 12:27:29 UTC] {subprocess.py:92} INFO - DETAIL: Key (dag_id)=(test_base_config) is still referenced from table "dag_tag".

@ephraimbuddy
Copy link
Contributor

I am seeing the same issue in 2.3.0 [2022-06-27, 12:27:29 UTC] {subprocess.py:92} INFO - sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "dag" violates foreign key constraint "dag_tag_dag_id_fkey" on table "dag_tag" [2022-06-27, 12:27:29 UTC] {subprocess.py:92} INFO - DETAIL: Key (dag_id)=(test_base_config) is still referenced from table "dag_tag".

It's fixed in 2.3.2

@anka0618
Copy link

I see the same issue when i run start task in one of my dags. I am using airflow 2.4.3 version.

sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "dag_run" violates foreign key constraint "task_instance_dag_run_fkey" on table "task_instance"

@swathida-byte
Copy link

same, I still see this error
sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "dag" violates foreign key constraint "dag_tag_dag_id_fkey" on table "dag_tag"
Key (dag_id)=(status_notify_QATS) is still referenced from table "dag_tag".

@anka0618
Copy link

Any suggestions would be appreciated.

@ephraimbuddy
Copy link
Contributor

If you are still seeing this issue, please create a new issue and describe your setup and how to reproduce it. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants