Project

Profile

Help

Issue #8351

closed

Error when deleting content - violates foreign key constraint

Added by adam.winberg@smhi.se about 3 years ago. Updated about 3 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

I've run into some problems with deleting content - I've run my migrations and put my pulp3 box into production. Since migrations were finished I uninstalled the 2to3migration plugin, thinking it would clean up after itself. But now I run into some issues when trying to remove some repository versions and also when trying to delete orphans.

Error message when trying to delete a repository version:

django.db.utils.IntegrityError: update or delete on table "core_publication" violates foreign key constraint "pulp_2to3_migration__pulp3_publication_id_221e8b1c_fk_core_publ" on table "pulp_2to3_migration_pulp2distributor"

This does not happen on all repositories, but on those where it does I get the same error when trying to delete the whole repository.

Error message when deleting orphans:

psycopg2.errors.ForeignKeyViolation: update or delete on table "core_content" violates foreign key constraint "pulp_2to3_migration__pulp3_content_id_6271a7bb_fk_core_cont" on table "pulp_2to3_migration_pulp2content"
DETAIL:  Key (pulp_id)=(0126dbf5-560d-4e9f-9278-92b468dbb1de) is still referenced from table "pulp_2to3_migration_pulp2content".

Not sure if this should be filed under the migration category since I have uninstalled the plugin, but since the errors are very much related to the migration plugin it might belong here.

I am aware of #7822, but in the mean time is there a safe way for me to clean my db from 2to3migration stuff manually to get rid of these errors?

Versions: python3-pulpcore-3.9.1-1.el8.noarch python3-pulp-rpm-3.8.0-1.el8.noarch

Was using python3-pulp-2to3-migration-0.6.0-2.el8.noarch when doing my migration, but has since uninstalled it.

Actions #1

Updated by ttereshc about 3 years ago

FYI, I'll try to look into it this week.

Actions #2

Updated by ttereshc about 3 years ago

Reproduced.
Repo version removal worked for me when I installed the pulp-2to3-migration plugin back.
Same for the orphan cleanup.

Could you try to install back the migration plugin (preferably the same version you had, so there are no upgrade/data migrations for it added) and see if it helps?
FYI, when you uninstall it, there is no cleanup, it;s just python package was uninstalled, so all pulp-2to3-migration tables and data are still there.

Let me know if it helped.
Thanks!

Actions #3

Updated by ttereshc about 3 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ttereshc
Actions #4

Updated by ttereshc about 3 years ago

  • Status changed from ASSIGNED to NEW
  • Assignee deleted (ttereshc)

Waiting on reply. I'll unassign for now, since there is no work in progress here.

Actions #5

Updated by adam.winberg@smhi.se about 3 years ago

Sorry about the delay.

I installed the migration plugin, but it didn't make any difference, still the same error when trying to delete repo or doing orphan cleanup. I then tried to run migrations (django migration, that is) (which shouldn't be needed though, right?), and got an error:

ValueError: Found wrong number (0) of constraints for pulp_2to3_migration_pulp2iso(name, checksum, size, pulp2content_id)
Actions #6

Updated by adam.winberg@smhi.se about 3 years ago

Not completely sure, I might have used python3-pulp-2to3-migration-0.5.1-1.el8.noarch during my migrations - but I cant install that one now since it wont install on python3-pulpcore > 3.9

Actions #7

Updated by ttereshc about 3 years ago

Thanks, ok, let me try to reproduce it with migration 0.5 and the upgrade to pulpcore 3.9 and see if I can find the way out.

Actions #8

Updated by ttereshc about 3 years ago

I'm not able to reproduce it. Installing any version works for me and running django migrations as well. So there is something different going on on your system. To unblock you and since you do not need migration plugin anymore anyway, I'll send you in PM which migration plugin related tables to drop. And it should be it. I'm not posting anything here, not to encourage folks to take the manual path.

Actions #9

Updated by ttereshc about 3 years ago

  • Status changed from NEW to CLOSED - WONTFIX

Provided workaround helped. Closing as per agreement with the OP. Plugin removal feature is tracked in https://pulp.plan.io/issues/7822

Also available in: Atom PDF