Bug 2215093

Summary: Optimize DockerMetaTag query and CV version deletion to run a single invocation of the method.
Product: Red Hat Satellite Reporter: Samir Jha <sajha>
Component: RepositoriesAssignee: Samir Jha <sajha>
Status: CLOSED ERRATA QA Contact: David Moore <damoore>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.0CC: damoore, fgarciad, pcreech
Target Milestone: 6.14.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-katello-4.9.0.7-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:19:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Samir Jha 2023-06-14 17:48:26 UTC
Test performance improvement between current query:

self.where("id not in (?) OR (schema2_id IS NULL AND schema1_id IS NULL)", Katello::RepositoryDockerMetaTag.pluck(:docker_meta_tag_id) + [0]).delete_all

vs 

self.where("(id != 0 and id not in (select docker_meta_tag_id from #{Katello::RepositoryDockerMetaTag.table_name})) OR (schema2_id IS NULL AND schema1_id IS NULL) ").delete_all

Also, have this method called once per CV version delete vs once per CV version repo delete to save unnecessary calls.

Comment 1 Samir Jha 2023-06-14 17:48:31 UTC
Created from redmine issue https://projects.theforeman.org/issues/36500

Comment 2 Samir Jha 2023-06-14 17:48:32 UTC
Upstream bug assigned to None

Comment 4 Bryan Kearney 2023-07-21 00:03:17 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36500 has been resolved.

Comment 10 errata-xmlrpc 2023-11-08 14:19:49 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.14 security and bug fix update), 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-2023:6818