Bug 2103246

Summary: Capsule sync fails with duplicate key value violates unique constraint "core_repositoryversion_repository_id_number
Product: Red Hat Satellite Reporter: Ricardo Santamaria <risantam>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Vladimír Sedmík <vsedmik>
Severity: high Docs Contact:
Priority: high    
Version: 6.10.6CC: ahumbe, aruzicka, dalley, dkliban, ggainey, rchan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-04 23:44:56 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:

Description Ricardo Santamaria 2022-07-01 18:52:39 UTC
When attempts to sync capulse with 8 pulpcore workers sync gets: 

duplicate key value violates unique constraint "core_repositoryversion_repository_id_number_3c54ce50_uniq"
DETAIL:  Key (repository_id, number)=(8483dc67-8401-47ba-bb80-203f5a9c0429, 2) already exists.
duplicate key value violates unique constraint "core_repositoryversion_repository_id_number_3c54ce50_uniq"
DETAIL:  Key (repository_id, number)=(cb12fe97-4c5f-4424-a1ee-e4ff550dd46f, 2) already exists.
duplicate key value violates unique constraint "core_repositoryversion_repository_id_number_3c54ce50_uniq"
DETAIL:  Key (repository_id, number)=(8483dc67-8401-47ba-bb80-203f5a9c0429, 2) already exists.

Workaround provided in article https://access.redhat.com/solutions/6718181 solves this by:

1. Stop all but 1 worker on the affected Capsule servers:
    
   # for i in {2..8} ; do systemctl stop pulpcore-worker@${i}; done

2. Verify all but 1 worker is stopped:

   # for i in {1..8} ; do systemctl status pulpcore-worker@${i} | grep Active; done

3. After that trigger an Optimized Capsule sync against the affected Capsules.

Comment 6 pulp-infra@redhat.com 2022-11-16 14:07:25 UTC
The Pulp upstream bug status is at closed. Updating the external tracker on this bug.

Comment 7 Red Hat Bugzilla 2023-09-18 04:40:56 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days