Bug #11028
closed
Nightly repo syncs often result in duplicate key error
Added by Jason Frisvold about 9 years ago.
Updated 7 months ago.
Description
I have a number of repos set to sync at midnight each night. Each night, at least one repo sync seems to fail with an error similar to this :
PGError: ERROR: duplicate key value violates unique constraint "katello_system_errata_eid_sid"
: INSERT INTO katello_system_errata (erratum_id, system_id) VALUES (2647, 5)
I can correct this by just resuming the task and it finishes with no additional errors.
- Project changed from Foreman to Katello
- Category deleted (
47)
- Triaged set to No
- Status changed from New to Need more information
- Translation missing: en.field_release set to 31
- Triaged changed from No to Yes
What version of Katello are you seeing this on?
I'm running Katello 2.2.1 and Foreman 1.8.2.
I'm affected by this bug as well. Also on Katello 2.2.1 / Foreman 1.8.2 / RHEL 7.1 and it happens during the daily sync of repositories
I was able to reproduce the issue: seems like it happens when multiple repositories are being synchronized at the same time, so that the errata applicability import is happening for a given host multiple times at once.
After resuming the task the operation seemed to proceed successfully (no even need for skip the failing step). One possible fix would be either to:
1. make the code https://github.com/Katello/katello/blob/master/app/models/katello/glue/pulp/consumer.rb#L94 retry several times before failling, to cound on the fact that some other repo might be recalculating the applicability
2. limit the errata touched by this operation withing the Repo sync only to those affected by the repository that is just being synchronized
I belive the right answer would be the combination of these two.
- Bugzilla link set to 1244704
- Status changed from Need more information to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/5368 added
- Pull request deleted (
)
- Assignee set to Justin Sherrill
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Category changed from Web UI to Repositories
- Status changed from Closed to Assigned
- Translation missing: en.field_release changed from 31 to 86
- Difficulty set to medium
Reopening due to reports of it still happening
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/Katello/katello/pull/5904 added
- Status changed from Ready For Testing to Closed
- Pull request https://github.com/Katello/katello/pull/10862 added
- Pull request deleted (
https://github.com/Katello/katello/pull/5368, https://github.com/Katello/katello/pull/5904, https://github.com/Katello/katello/pull/10862)
Also available in: Atom
PDF