Bug 2253381

Summary: Failed incremental CV import shows error: duplicate key value violates unique constraint "rpm_updatecollectionname_name_update_record_id_6ef33bed_uniq"
Product: Red Hat Satellite Reporter: Brenden Wood <bwood>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: sganar
Severity: high Docs Contact:
Priority: high    
Version: 6.13.0CC: ahumbe, alsouza, arahaman, dalley, dhjoshi, dkliban, ggainey, hyu, iballou, jpasqual, juqiao, keiwilli, osousa, rchan, rlavi, satellite6-bugs, shwsingh, sleahy, wclark, zhunting
Target Milestone: 6.15.0Keywords: Triaged
Target Release: UnusedFlags: arahaman: needinfo? (satellite6-bugs)
arahaman: needinfo? (wclark)
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pulp_rpm-3.17.22, pulp_rpm-3.18.20, pulp_rpm-3.19.12, pulp_rpm-3.23.3, pulp_rpm-3.25.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2266139 (view as bug list) Environment:
Last Closed: 2024-04-23 17:16:06 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
RHEL 8 Hotfix RPM for Satellite 6.11.5.6
none
RHEL 7 Hotfix RPM for Satellite 6.11.5.6
none
Hotfix RPM for Satellite 6.14.2 none

Description Brenden Wood 2023-12-07 00:56:33 UTC
Description of problem:

We are running a CV version import ( incremental ) with:


```
hammer content-import version --organization-id=1 --path=/var/lib/pulp/imports/2023-1-28T03-49-03-00-00
```

...but has produced the following errors repeated for several repositories at about 61% of task completion.

Example:

```
duplicate key value violates unique constraint "rpm_updatecollectionname_name_update_record_id_6ef33bed_uniq"
```

This error repeats several times for various RHEL 7,8 and 9 repositories.

Please note that we can *NOT* provide a sosreport, logs or tracebacks from this customer, and Satellite is running in an air-gapped disconnected environment. 

Our support case is https://access.redhat.com/support/cases/#/case/03679066/

There have been other support cases from different customers where this exact database key is reporting an error ( rpm_updatecollectionname_name_update_record_id_6ef33bed_uniq ), and in all of them Red Hat support has recommended that they switch to using the Syncable Exports feature instead of actually resolving the issue.

We are on version 6.11 of Satellite, but it's notable that other support cases indicate that the issue is present on Satellite 6.13 too.

Other support cases that contain the rpm_updatecollectionname_name_update_record_id_6ef33bed_uniq error:
https://access.redhat.com/support/cases/#/case/03671664 ( Sat 6.12 )
https://access.redhat.com/support/cases/#/case/03670822 ( Sat 6.13 )



Version-Release number of selected component (if applicable):
6.11
6.12
6.13

How reproducible:
Create large CV to export/import
After that succeeds, create incremental export and try to import that version of CV


Actual results:
duplicate key value violates unique constraint "rpm_updatecollectionname_name_update_record_id_6ef33bed_uniq"


Expected results:
Incremental Content View imports successfully 

Additional info:

Comment 1 Brenden Wood 2023-12-07 01:45:23 UTC
Adding this note from internal Slack discussion so it can be referenced later if need be:

The errors in my traceback say they are for:
`pulp_rpm/copy.py` line 223
`pulp_rpm/repository.py` lines 1017, 312
`pulp_rpm/advisory.py` lines 136, 314, 218, 206, 329 

Then some others in:
`django/django_lifecycle/mixins.py` line 134
`django/db/models/base.py` lines 739, 776, 881, 919
`django/db/models/manager.py` line 85
`django/db/models/query.py` line 1270
`django/db/models/sql/compiler.py` line 1416
`django/db/backends/utils.py` lines 66, 84, 75, 90

Comment 15 Robin Chan 2024-02-09 16:04:45 UTC
The Pulp upstream bug status is at closed. Updating the external tracker on this bug.

Comment 16 Robin Chan 2024-02-09 16:04:48 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 18 Ian Ballou 2024-02-21 21:15:44 UTC
Created attachment 2018063 [details]
RHEL 8 Hotfix RPM for Satellite 6.11.5.6

INSTALL INSTRUCTIONS (Satellite 6.11.5.6 on RHEL8):

1. Take a complete backup or snapshot of Satellite 6.11.5.6 server

2. Obtain the Hotfix RPM from this attachment

3. # dnf install ./python38-pulp-rpm-3.17.22-1.HOTFIXRHBZ2253381.el8pc.noarch.rpm --disableplugin=foreman-protector

4. # satellite-maintain service restart

Comment 20 Ian Ballou 2024-02-21 21:21:54 UTC
Created attachment 2018064 [details]
RHEL 7 Hotfix RPM for Satellite 6.11.5.6


INSTALL INSTRUCTIONS (Satellite 6.11.5.6 on RHEL7):

1. Take a complete backup or snapshot of Satellite 6.11.5.6 server

2. Obtain the Hotfix RPM from this attachment

3. # yum install ./tfm-pulpcore-python3-pulp-rpm-3.17.22-1.HOTFIXRHBZ2253381.el7pc.noarch.rpm --disableplugin=foreman-protector

4. # satellite-maintain service restart

Comment 21 wclark 2024-02-26 22:35:43 UTC
Created attachment 2019044 [details]
Hotfix RPM for Satellite 6.14.2

INSTALL INSTRUCTIONS

1. Take a complete backup or snapshot of Satellite 6.14.2 server

2. Obtain the Hotfix RPM from this attachment

3. # dnf install ./python39-pulp-rpm-3.19.11-3.HOTFIXRHBZ2253381.el8pc.noarch.rpm --disableplugin=foreman-protector

4. # satellite-maintain service restart

Comment 25 sganar 2024-03-08 11:44:02 UTC
Verified.

Tested on Satellite 6.15.0 Snap 10.1
python3.11-pulp-rpm-3.23.3-1.el8pc.noarch

Steps followed: 
1. Enable some repos, and sync them with the immediate download policy
2. Create a CV add the repos and publish it
3. Export complete the CV
4. Enable and sync some more repos, add them to the CV and publish it
5. Export the CV - incremental
6. Try to import the CV - complete and then incremental

Observation:
1. Content export was successful and no issues were observed
2. Content import was Successful and no issues were observed

Comment 30 errata-xmlrpc 2024-04-23 17:16:06 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 (Important: Satellite 6.15.0 release), 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/RHSA-2024:2010