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 1595955

Summary: Production.log shows PG::Error: ERROR: duplicate key value violates unique constraint "katello_host_installed_packages_h_id_ip_id"
Product: Red Hat Satellite Reporter: sthirugn <sthirugn>
Component: Content ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.1Keywords: PrioBumpField, Triaged
Target Milestone: Unspecified   
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: Environment:
Last Closed: 2018-07-05 12:46:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
production.log none

Description sthirugn@redhat.com 2018-06-27 21:50:06 UTC
Description of problem:
Production.log shows PG::Error: ERROR:  duplicate key value violates unique constraint "katello_host_installed_packages_h_id_ip_id"

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

How reproducible:
Always

Steps to Reproduce:
1. Customer production.log shows a lot of duplicate key value error:

018-06-20 05:04:16  [foreman-tasks/action] [E] PG::Error: ERROR:  duplicate key value violates unique constraint "katello_host_installed_packages_h_id_ip_id"
 | DETAIL:  Key (host_id, installed_package_id)=(56349, 67092) already exists.
 | : INSERT INTO katello_host_installed_packages (installed_package_id, host_id) VALUES (67092, 56349), (67095, 56349), (67099, 56349), (67107, 56349), (67111, 56349), (67114, 56349), (67121, 56349), (67129, 56349), (67136, 56349), (67140, 56349), (67147, 56349), (67153, 56349), (67157, 56349), (67167, 56349), (67169, 56349), (67179, 56349) (ActiveRecord::RecordNotUnique)
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `exec'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'

The full error is attached with this bugzilla. I believe this is triggered by Package profile uploads.

Actual results:
Error as shown above

Expected results:
No error on package profile uploads

Additional info:
I saw this from a customer log.

Comment 2 sthirugn@redhat.com 2018-06-27 22:06:53 UTC
Created attachment 1455136 [details]
production.log

Comment 5 Brad Buckingham 2018-07-05 12:46:01 UTC

*** This bug has been marked as a duplicate of bug 1595301 ***