Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2077046

Summary: Upgrade fails during db:migrate with PG::ForeignKeyViolation: ERROR: update or delete on table "katello_errata" violates foreign key constraint "katello_content_facet_errata_errata_id"
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: Errata ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.10.5CC: akjha, sajha, swadeley, vijsingh, zhunting
Target Milestone: 6.10.5Keywords: Triaged, UpgradeBlocker, Upgrades
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2075519 Environment:
Last Closed: 2022-05-04 12:59:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2075519    
Bug Blocks:    

Comment 3 Lukas Pramuk 2022-04-20 14:39:37 UTC
The similar upgrade issue is on 6.10.5 Snap1 with slightly different error message:


2022-04-20 09:59:03 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::ForeignKeyViolation: ERROR:  update or delete on table "katello_errata" violates foreign key constraint "katello_erratum_bugzillas_errata_id_fk" on table "katello_erratum_bugzillas"
2022-04-20 09:59:03 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: DETAIL:  Key (id)=(11658) is still referenced from table "katello_erratum_bugzillas".

Comment 4 Lukas Pramuk 2022-04-20 14:58:20 UTC
# foreman-rake db:migrate
'ErbParser' is ignored.
'RubyParser' is ignored.
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
== 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_errata" violates foreign key constraint "katello_erratum_bugzillas_errata_id_fk" on table "katello_erratum_bugzillas"
DETAIL:  Key (id)=(11658) is still referenced from table "katello_erratum_bugzillas".
...

>>> so it is the same migration file as in original 6.11.0 BZ

Comment 5 Lukas Pramuk 2022-04-23 12:04:09 UTC
VERIFIED.

@Satellite 6.10.5 Snap2
tfm-rubygem-katello-4.1.1.55-1.el7sat.noarch

by the following manual reproducer:

1) Have QE upgrade template Satellite 6.10 (or fresh 6.10 and sync RHEL repositories)

2) Upgrade to 6.10.5

# satellite-maintain upgrade run --target-version 6.10.z -y
...

--------------------------------------------------------------------------------
Unlock packages:                                                      [OK]
--------------------------------------------------------------------------------
Update package(s) :                                                   [OK]
--------------------------------------------------------------------------------
Procedures::Installer::Upgrade:                                       [OK]
--------------------------------------------------------------------------------
Execute upgrade:run rake task:                                        [OK]
--------------------------------------------------------------------------------
...

--------------------------------------------------------------------------------
Upgrade finished.


>>> db:migrate finished successfully so the upgrade did

Comment 10 errata-xmlrpc 2022-05-04 12:59:16 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 (Important: Satellite 6.10.5 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.

https://access.redhat.com/errata/RHSA-2022:1708