Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37058 - Optimize query to identify orphaned content units #10851

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

jpasqualetto
Copy link
Member

What are the changes introduced in this pull request?

Optimizes query used to identify orphaned content units

Considerations taken when implementing this change?

Query generated by the method was slow and inefficient. This attempts to offer an alternative with better performance.

What are the testing steps for this pull request?

Execution time of Remove Orphans task should improve drastically.

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, looks fine to me but would prefer someone from team content to look. @ianballou can you take a look or Samir?

@parthaa
Copy link
Contributor

parthaa commented Jan 18, 2024

Copy pasting testing steps from
#10638 (comment)

  1. Check Katello::Rpm.count in foreman-rake console.
  2. Create a lot of orphaned content. You can create these by running below in foreman-rake console:
i = 1
while(i<50000)
f = Katello::Rpm.new(name: i, pulp_id: i)
f.save!
i +=1
end
  1. Check Katello::Rpm.count in console.
  2. Run bundle exec rails katello:delete_orphaned_content . Go to foreman task in UI and wait for it to complete.
  3. Check Katello::Rpm.count again. The orphaned dummy rpm records should get cleaned up..

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runs much faster, thanks @jpasqualetto

@chris1984 chris1984 self-assigned this Jan 22, 2024
@chris1984 chris1984 merged commit 799b4c0 into Katello:master Jan 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants