Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1745516 - Multiple duplicate index entries are present in candlepin database
Summary: Multiple duplicate index entries are present in candlepin database
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Candlepin
Version: 6.5.0
Hardware: All
OS: All
unspecified
medium
Target Milestone: 6.8.0
Assignee: satellite6-bugs
QA Contact: Lai
URL:
Whiteboard:
Depends On: 1752975
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-26 10:08 UTC by Ranjan Kumar
Modified: 2023-03-24 15:19 UTC (History)
6 users (show)

Fixed In Version: candlepin-2.10.0-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1752975 (view as bug list)
Environment:
Last Closed: 2020-10-27 12:59:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:4366 0 None None None 2020-10-27 12:59:20 UTC

Description Ranjan Kumar 2019-08-26 10:08:43 UTC
Description of problem: There are multiple duplicate indexes present in candlepin database. Having identical indexes means the DB is spending more time updating two indexes when only one needs to be updated. Duplicate indexes should be cleaned up and there should be a workaround to cleanup indexes in the current version. We should remove the unwanted indexes during the upgrades

In Customer DB, these are the duplicate indexes are present in the DB 

 size  |                 idx1                  |           idx2           
--------+---------------------------------------+--------------------------
 262 MB | cp_content_override_key_id_for_cs_idx | cp_content_override_idx1 
 576 kB | cp_pool_source_stack_pool_ukey        | idx_sourcestack_pool_fk  
 32 kB  | cp_dist_version_pkey                  | cp_dist_version_id_idx   

In local environment Satellite 6.5(upgraded from 6.4) having below duplicate indexes

#su - postgres -c "psql -d candlepin -c 'SELECT indrelid::regclass AS TableName,array_agg(indexrelid::regclass) AS Indexes FROM pg_index GROUP BY indrelid,indkey HAVING COUNT(*) > 1;;'"
      tablename       |                         indexes                          
----------------------+----------------------------------------------------------
 cp_dist_version      | {cp_dist_version_id_idx,cp_dist_version_pkey}
 cp_pool_source_stack | {cp_pool_source_stack_pool_ukey,idx_sourcestack_pool_fk}
(2 rows)



Version-Release number of selected component (if applicable): 6.5


How reproducible: Always


Steps to Reproduce:
1. Try to find duplicate indexes using SQL query as per summary

Actual results: There are multiple duplicates indexes


Expected results: Duplicate indexes should not be present

Comment 3 Barnaby Court 2019-09-12 14:02:31 UTC
Index entries such as cp_content_override_key_id_for_cs_idx where hand created by the customer. Satellite is now providing providing equivalent indexes. As the customer created the original index by hand, if the customer does not wish to have duplicate indexes for the same fields, the customer should delete the indexes that they created.

Comment 7 Barnaby Court 2019-09-17 17:07:49 UTC
Moving to new as there were 2 other pairs of indexes that are worth considering cleanup:

cp_pool_source_stack_pool_ukey & idx_sourcestack_pool_fk 
cp_dist_version_pkey & cp_dist_version_id_idx

Comment 8 Nikos Moumoulidis 2020-04-30 12:19:25 UTC
The Candlepin bz has been closed, and the fix has been released in candlepin-2.10.0-1 (current master). This will be included in Sat 6.8

Comment 9 Lai 2020-06-17 18:54:46 UTC
Steps to retest:

1. ssh into satellite
2. Run command: su - postgres -c "psql -d candlepin -c 'SELECT indrelid::regclass AS TableName,array_agg(indexrelid::regclass) AS Indexes FROM pg_index GROUP BY indrelid,indkey HAVING COUNT(*) > 1;;'"

Expected result:
o duplicates in db

Actual result:
 tablename | indexes 
-----------+---------
(0 rows)

Verified on 6.7.0_05.

I've already checked using su - postgres -c "psql -d candlepin -c 'SELECT indrelid::regclass AS TableName,array_agg(indexrelid::regclass) AS Indexes FROM pg_index GROUP BY indrelid,indkey;;'" and saw that there's no duplicate.

Comment 12 errata-xmlrpc 2020-10-27 12:59:02 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.8 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-2020:4366


Note You need to log in before you can comment on or make changes to this bug.