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 2055951 - Index content is creating duplicated errata in "katello_erratum" table after upgrading to Satellite 6.10
Summary: Index content is creating duplicated errata in "katello_erratum" table after ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.11.0
Assignee: satellite6-bugs
QA Contact: Lai
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-18 02:30 UTC by Hao Chang Yu
Modified: 2022-07-18 22:01 UTC (History)
8 users (show)

Fixed In Version: tfm-rubygem-katello-4.3.0.15-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2070994 (view as bug list)
Environment:
Last Closed: 2022-07-05 14:33:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34549 0 Normal New Index content is creating duplicated errata in "katello_erratum" table after upgrading to Satellite 6.10 2022-03-02 19:16:13 UTC
Red Hat Knowledge Base (Solution) 6962927 0 None None None 2022-06-17 12:28:50 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:33:48 UTC

Description Hao Chang Yu 2022-02-18 02:30:17 UTC
Description of problem:
Index content is creating duplicated errata in "katello_erratum" table after upgrading to Satellite 6.10. This is because the existing errata has pulp2 id in pulp_id column. The newly created errata will have the errata_id in the pulp_id column. Katello considers them as different errata.

It appears that Satellite doesn't switch the entries in katello_erratum during the content switchover. Is this the expected behaviour? If not, should we remove them and how can we safely remove the old errata (with pulp2 id) which are still associated to the old versions of content view repositories?


foreman-rake console
> pp Katello::Erratum.where(errata_id: "RHBA-2019:1293").first.pulp_id
"78f852c6-44bc-411c-9d43-615b1ea6ccfe"  <==== pulp2 id
> pp Katello::Erratum.where(errata_id: "RHBA-2019:1293").second.pulp_id
"RHBA-2019:1293  <=== errata_id
exit


# select errata_id, count(errata_id) count from katello_errata group by errata_id order by count desc;
   errata_id    | count 
----------------+-------
 RHEA-2021:1949 |     2
 RHEA-2018:0867 |     2
 RHSA-2021:0289 |     2
 RHBA-2020:5049 |     2
 RHBA-2018:3024 |     2
 RHBA-2019:2025 |     2
 RHSA-2015:1666 |     2
 RHBA-2020:4452 |     2
 RHSA-2021:0989 |     2
 RHBA-2021:0243 |     2
<snip>


The duplicated errata have 0 module streams which break the content view filtering. If you have a filter to "include/exclude all module streams without errata" then unexpected module streams and errata will be included/excluded.


> pp Katello::Erratum.where(errata_id: "RHBA-2019:1293").first.module_streams.size
1  <====
> pp Katello::Erratum.where(errata_id: "RHBA-2019:1293").second.module_streams.size
0  <====


The empty module streams for the duplicated/second erratum can be fixed by applying the following change:

--- a/app/services/katello/pulp3/erratum.rb     2021-12-18 03:12:39.000000000 +1000
+++ b/app/services/katello/pulp3/erratum.rb     2022-02-18 12:06:05.668000000 +1000
@@ -102,7 +102,7 @@
             module_stream_id_column = "#{ModuleStreamErratumPackage.table_name}.module_stream_id"
             existing = ErratumPackage.joins(:module_streams).
                                       where(module_stream_id_column => module_stream.id,
-                                            :nvrea => nvreas).pluck(:nvrea)
+                                            :nvrea => nvreas, :erratum_id => model.id).pluck(:nvrea)

             (nvreas - existing).each do |nvrea|
               package = model.packages.find_by(:nvrea => nvrea)



Katello upstream seems to have included this fix already after refactoring the content indexing codes.

https://github.com/Katello/katello/blob/master/app/services/katello/pulp3/erratum.rb#L106



Steps to Reproduce:
1. Upgrade Satellite from 6.9 to 6.10
2. After upgrading the Satellite, trigger complete sync against one or more repositories (particularly those with module streams) and wait until they are finished.

Actual results:
Duplicated errata created in katello_erratum table. Duplicated modular errata have 0 module streams.

Expected results:
No duplicate errata

Comment 4 Samir Jha 2022-03-02 19:16:13 UTC
Created redmine issue https://projects.theforeman.org/issues/34549 from this bug

Comment 5 ileppala 2022-03-04 08:02:24 UTC
We also upgraded to satellite 6.10, (6.10.2 to be exact) and we are also affected by the same bug.

Comment 6 Bryan Kearney 2022-03-07 20:05:34 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34549 has been resolved.

Comment 12 errata-xmlrpc 2022-07-05 14:33:38 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 (Moderate: Satellite 6.11 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-2022:5498


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