Bug 1319309

Summary: duplicate key value violates unique constraint errors
Product: Red Hat Satellite Reporter: John Mitsch <jomitsch>
Component: Content ManagementAssignee: John Mitsch <jomitsch>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.4CC: bbuckingham, ehelms, jcallaha, sthirugn
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/13085
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:28:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description John Mitsch 2016-03-18 19:09:10 UTC
This seems to be related to rails 4, errors that look like

PG::Error: ERROR:  duplicate key value violates unique constraint "index_katello_repository_package_groups_on_pgid_repoid"
DETAIL:  Key (package_group_id, repository_id)=(3, 2) already exists.
: INSERT INTO katello_repository_package_groups (package_group_id, repository_id, created_at, updated_at) VALUES (3, 2, '2016-01-08 14:28:11 UTC', '2016-01-08 14:28:11 UTC'), (4, 2, '2016-01-08 14:28:11 UTC', '2016-01-08 14:28:11 UTC')
409 Conflict

are popping up somewhat randomly.

One way to possibly recreate:
1. create repo, 2. sync repo, 3. create content view, 4. add repo to view, 5. publish view 

also is seen during katello:reset         

possibly race conditions?

Comment 1 John Mitsch 2016-03-18 19:09:12 UTC
Created from redmine issue http://projects.theforeman.org/issues/13085

Comment 2 John Mitsch 2016-03-18 19:09:43 UTC
Note that this is a transient error and will not happen every time you publish a content view

Comment 5 John Mitsch 2016-03-30 16:09:48 UTC
PR open upstream https://github.com/Katello/katello/pull/5902

Comment 6 Bryan Kearney 2016-03-30 18:11:51 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/13085 has been closed
John Mitsch
Applied in changeset commit:katello|c92c13fa113533fc8cf255e9d12038a4069067ec.

Comment 7 jcallaha 2016-04-06 20:46:54 UTC
Verified in Satellite 6.2 Beta Snap 6 Compose 2.

No longer able to reproduce the issue with over 50 publishes and promotions.

Comment 9 errata-xmlrpc 2016-07-27 09:28:00 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, and where to find the updated
files, follow the link below.

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