Bug 2081931 - PG::ForeignKeyViolation: ERROR: update or delete on table "katello_erratum_packages" violates foreign key constraint "katello_msep_erratum_package_id_fk" on table "katello_module_stream_erratum_packages"
Summary: PG::ForeignKeyViolation: ERROR: update or delete on table "katello_erratum_p...
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Errata Management
Version: 6.10.5
Hardware: Unspecified
OS: Unspecified
high vote
Target Milestone: 6.10.5
Assignee: Samir Jha
QA Contact: Lukas Pramuk
Depends On:
Blocks: 2083532
TreeView+ depends on / blocked
Reported: 2022-05-05 02:56 UTC by matt jia
Modified: 2022-06-14 17:52 UTC (History)
18 users (show)

Fixed In Version: tfm-rubygem-katello-
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2083532 (view as bug list)
Last Closed: 2022-05-11 16:28:08 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34870 0 High Ready For Testing PG::ForeignKeyViolation: ERROR: update or delete on table "katello_erratum_packages" violates foreign key constraint "k... 2022-05-06 11:13:32 UTC
Red Hat Knowledge Base (Solution) 6956981 0 None None None 2022-05-09 06:07:32 UTC
Red Hat Product Errata RHBA-2022:2203 0 None None None 2022-05-11 16:28:12 UTC

Description matt jia 2022-05-05 02:56:17 UTC
Description of problem:

Upgrading to 6.10.5 fails with below error:

root@ctqlsat06 ~]# foreman-rake db:migrate --trace --verbose
'ErbParser' is ignored.
'RubyParser' is ignored.
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
** Execute db:load_config
** Invoke plugin:refresh_migrations (first_time)
** Invoke environment
** Execute plugin:refresh_migrations
** Execute db:migrate
== 20220303160220 RemoveDuplicateErrata: migrating ============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::ForeignKeyViolation: ERROR:  update or delete on table "katello_erratum_packages" violates foreign key constraint "katello_msep_erratum_package_id_fk" on table "katello_module_stream_erratum_packages"
DETAIL:  Key (id)=(264838) is still referenced from table "katello_module_stream_erratum_packages".
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord- `async_exec_params'

Version-Release number of selected component (if applicable):

How reproducible:

Unknown as it happens on one of the customers' Satellite

Steps to Reproduce:

Actual results:

failed upgrade due to failing db:migrate

Expected results:

successful upgrade

Additional info:

It's quite similar to bz#2075519, but this happens on a different table.

Comment 2 Samir Jha 2022-05-05 20:47:08 UTC
Created redmine issue https://projects.theforeman.org/issues/34870 from this bug

Comment 11 Bryan Kearney 2022-05-09 16:05:18 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34870 has been resolved.

Comment 14 Lukas Pramuk 2022-05-10 15:49:30 UTC

@Satellite Snap1

by the following manual reproducer:

1) Have a Satellite 6.10.z

2) Sync RHEL8 (BaseOS, Appstream) repos !!!

3) Upgrade to

# satellite-maintain upgrade run --target-version 6.10.z -y -w repositories-validate,repositories-setup

Running Migration scripts to Satellite 6.10.z
Setup repositories:                                                   [SKIPPED]
Unlock packages:                                                      [OK]
Update package(s) :                                                   [OK]
Procedures::Installer::Upgrade:                                       [OK]
Execute upgrade:run rake task:                                        [OK]

Upgrade finished.

>>> upgrade to is successful

Comment 19 errata-xmlrpc 2022-05-11 16:28:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Satellite Async Bug Fix Update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.