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 2030714 - Upgrade to Satellite 6.10 fails on content-switchover - Postgresql: duplicate key value violates unique constraint "index_katello_rpms_on_pulp_id"
Summary: Upgrade to Satellite 6.10 fails on content-switchover - Postgresql: duplicate...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.9.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: 6.9.8
Assignee: Justin Sherrill
QA Contact: Akhil Jha
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-09 14:53 UTC by Jaroslav Krajicek
Modified: 2022-02-25 21:58 UTC (History)
11 users (show)

Fixed In Version: tfm-rubygem-katello-3.18.1.49-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-01-27 17:33:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34155 0 Normal Ready For Testing prevent content actions if pulp3 content exists in the rpm table and pulp2 is in use 2022-01-04 18:01:26 UTC
Red Hat Product Errata RHBA-2022:0320 0 None None None 2022-01-27 17:33:17 UTC

Description Jaroslav Krajicek 2021-12-09 14:53:43 UTC
Description of problem:

Upgrade to Satellite 6.10 fails on katello:pulp3_content_switchover, blocking further steps.

~~~
Failed executing foreman-rake katello:pulp3_content_switchover, exit status 1:
 API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
rake aborted!
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_katello_rpms_on_pulp_id"
DETAIL:  Key (pulp_id)=(/pulp/api/v3/content/rpm/packages/979d5477-4c2e-4994-9367-9ef5d3387258/) already exists.
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `async_exec_params'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache'
~~~

How reproducible:
 Reverting and re-run results in the same

Additional info:
 Attached trace output

Comment 2 Justin Sherrill 2021-12-09 15:04:47 UTC
do we have a reproducer?  or would it be possible to get the foreman & pulpcore postgresql databases from a customer?

Comment 12 Paul Dudley 2021-12-11 00:31:26 UTC
Attached another customer case to this, errors seem to fit the pattern:
~~~
Several variant IDs of this:
374:2021-12-10 13:07:56 EST ERROR:  duplicate key value violates unique constraint "core_artifact_sha256_key"
375-2021-12-10 13:07:56 EST DETAIL:  Key (sha256)=(d0cbb960d9e7579b29c3a946c344b7efa4f4bab6e357f9f2c1a9ced8ce0ff518) already exists.
--
A couple copies of these, one for each content-switchover attempt after the issue:
377:2021-12-10 13:25:41 EST ERROR:  duplicate key value violates unique constraint "index_katello_rpms_on_pulp_id"
378-2021-12-10 13:25:41 EST DETAIL:  Key (pulp_id)=(/pulp/api/v3/content/rpm/packages/6f0e4a46-3556-4c26-96cb-1fad61475c0d/) already exists.
~~~

No errors observed in Migration tasks. Initial upgrade attempt failed due to yum dependency issue, not related to migrating content. Confirmed that in between the pre-migration tasks and the resolution of the dependency issue (thus another run of the content-switchover) two repos were synced. Unable to confirm exactly these things as we don't have the DB, but the case seems to fit scenario in comment 8 exactly.

Comment 14 Justin Sherrill 2021-12-13 18:00:28 UTC
Plan of action:

1) create a rake task that will attempt to cleanup data from pulp2's usage after switchover
2) Add checks on 6.9.z at sync time, cv publish/promote, package upload to stop any actions if switchover has been performed
3) update foreman-maintain/satellite-maintain to warn users that once switchover completes, they cannot go back to 6.9

Comment 17 Justin Sherrill 2021-12-16 18:12:22 UTC
Connecting redmine issue https://projects.theforeman.org/issues/34155 from this bug

Comment 19 Bryan Kearney 2022-01-06 00:05:12 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34155 has been resolved.

Comment 24 Akhil Jha 2022-01-25 11:03:15 UTC
Verified sat 6.9.8-snap2.0

Steps followed:
1) Synced repos and created few custom products,LCE,CV
2) Upgrade to 6.10 successful (Steps: https://access.redhat.com/documentation/en-us/red_hat_satellite/6.10/html-single/upgrading_and_updating_red_hat_satellite/index#preparing_to_migrate_pulp_content)

Comment 30 errata-xmlrpc 2022-01-27 17:33:09 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 6.9.8 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/RHBA-2022:0320


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