Bug 2172655

Summary: when running reindex on foremandb issue with duplicates on katello_erratum_packages table
Product: Red Hat Satellite Reporter: Paul Dudley <pdudley>
Component: Errata ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: high Docs Contact:
Priority: high    
Version: 6.12.1CC: ahumbe, bbuckingham, iballou, mjia, sajha, tasander
Target Milestone: UnspecifiedKeywords: Triaged
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: 2023-04-10 21:00:44 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 Paul Dudley 2023-02-22 21:34:25 UTC
Satellite 6.12.2 running a reindexdb on foreman retrieves;
~~~
DEBUG:  building index "katello_erratum_packages_eid_nvrea_n_f" on table "katello_erratum_packages" with request for 1 parallel worker
reindexdb: error: reindexing of database "foreman" failed: ERROR:  could not create unique index "katello_erratum_packages_eid_nvrea_n_f"
DETAIL:  Key (erratum_id, nvrea, name, filename)=(61289, libpmemobj++-devel-1.4-3.el7.x86_64, libpmemobj++-devel, libpmemobj++-devel-1.4-3.el7.x86_64.rpm) is duplicated.
~~~

The duplicates are numerous, as well;
~~~
[root@satellite ~]# echo "select erratum_id, filename, count(*) from katello_erratum_packages group by erratum_id, filename having count(*) > 1;" | sudo -u postgres psql foreman | tail
could not change directory to "/root": Permission denied
      62723 | gcc-objc++-4.8.5-16.el7.x86_64.rpm                     |     2
      62723 | gcc-objc-4.8.5-16.el7.x86_64.rpm                       |     2
      62772 | gcc-objc++-4.8.5-16.el7_4.2.x86_64.rpm                 |     2
      63154 | libpmemobj++-devel-1.2.1-4.el7.x86_64.rpm              |     2
      63248 | gcc-objc-4.8.5-28.el7.x86_64.rpm                       |     2
      63299 | gcc-objc++-4.8.5-4.el7.x86_64.rpm                      |     2
      63546 | gcc-objc++-4.8.2-16.2.el7_0.x86_64.rpm                 |     2
      63546 | gcc-objc-4.8.2-16.2.el7_0.x86_64.rpm                   |     2
(83 rows)
~~~

It seems like this is perhaps limited to 6.12.2 but no confirmation there yet.

Comment 1 Brad Buckingham 2023-02-23 15:14:29 UTC
Hi Paul,

Thanks for raising.  Can you provide the reproducer steps?

Comment 2 Paul Dudley 2023-02-23 15:20:59 UTC
Brad,

Thanks. I've tried yesterday to reproduce on a 6.12 system that had been upgraded from at least 6.10 and failed to reproduce it. I'm still trying to look into root cause for this. So far we have at least one customer case and I have an internal Satellite with this issue which I can provide for troubleshooting if that helps, or DB dumps as well if that can help. If I stumble on more info here I will update the bz.

Thanks
Paul

Comment 8 Ian Ballou 2023-04-10 21:00:44 UTC
Closing this as a duplicate -- please reopen this issue if it's found to not be caused by the LEAPP upgrade.

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