Project

General

Profile

Bug #18116

Katello::<Unit type>.import_all function breaks repository association after upgrading satellite or running reindex rake task

Added by Justin Sherrill over 4 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Repositories
Target version:
Difficulty:
easy
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1412486

Description of problem:
After upgrading to satellite 6.2.6, the repositories package count went unreasonably less in the Web UI

For example: Software collection repo only shows 30 packages

After investigating further I notice a bug in "import_all" function.

Katello::Rpm.import_all is fetching rpms from Pulp by chunk (default 100 units per chunk) and call the "sync_repository_associations" function on every chunk which breaks the repository associations in Katello. That is because "sync_repository_associations" will delete the existing associations that are not in the chunk.

For example:
Existing associations = [1, 2, 3, 4]

Pulp chunk 1 = [1, 2, 3, 5]

  1. Will be added
    new associations = Pulp chunk 1 - Existing associations
    [5] = [1, 2, 3, 5] - [1, 2, 3, 4]
  1. Will be deleted
    old association = Existing associations - Pulp chunk 1
    [4] = [1, 2, 3, 4] - [1, 2, 3, 5]

As a result the existing associations will become [1, 2, 3, 5].

Now Pulp chunk 2 = [6, 7, 8]

  1. Will be deleted
    old association = Existing associations - Pulp chunk 2
    [1, 2, 3, 5] = [1, 2, 3, 5] - [6, 7, 8]

As a result the existing associations will now become [6, 7, 8].

Version-Release number of selected component (if applicable):
6.2.6. Could also happen in the earlier versions because customer complain that it happened multiple times in different versions.

How reproducible:
Run satellite-installer --upgrade

Or

foreman-rake katello::reindex

Associated revisions

Revision 78e9b1a5 (diff)
Added by Justin Sherrill over 4 years ago

Fixes #18116 - properly import all units

due to the added paging nature of the import
process, the repo associations were done in
a paged maner. However each page would then
remove all the previously indexed units. This
change deletes the repo to unit entries, and
then does an additive repo association

History

#1 Updated by Justin Sherrill over 4 years ago

  • Category changed from 111 to Repositories
  • Assignee set to Justin Sherrill
  • Target version set to 157
  • Difficulty set to easy

#2 Updated by The Foreman Bot over 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/6553 added

#3 Updated by Justin Sherrill over 4 years ago

  • Legacy Backlogs Release (now unused) set to 188

#4 Updated by Justin Sherrill over 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF