Project

General

Profile

Actions

Bug #34549

closed

Index content is creating duplicated errata in "katello_erratum" table after upgrading to Satellite 6.10

Added by Samir Jha almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Content Views
Target version:
Fixed in Releases:
Found in Releases:

Description

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

  1. 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

Actions #1

Updated by The Foreman Bot almost 3 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Samir Jha
  • Pull request https://github.com/Katello/katello/pull/9997 added
Actions #2

Updated by The Foreman Bot almost 3 years ago

  • Fixed in Releases Katello 4.5.0 added
Actions #3

Updated by Samir Jha almost 3 years ago

  • Status changed from Ready For Testing to Closed
Actions #4

Updated by Ian Ballou almost 3 years ago

  • Subject changed from Index content is creating duplicated errata in "katello_erratum" table after upgrading to Satellite 6.10 to Index content is creating duplicated errata in "katello_erratum" table after upgrading to Satellite 6.10
  • Target version set to Katello 4.3.2
  • Triaged changed from No to Yes
Actions #5

Updated by The Foreman Bot over 2 years ago

  • Pull request https://github.com/Katello/katello/pull/10043 added
Actions

Also available in: Atom PDF