Error when deleting content - violates foreign key constraint
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.
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.
#5 Updated by firstname.lastname@example.org 8 months 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)
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.
Please register to edit this issue