Bug 455741

Summary: Performance problem when attempting to remove packages for large number of systems using SSM
Product: [Community] Spacewalk Reporter: Michael Mráka <mmraka>
Component: ServerAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: low Docs Contact:
Priority: low    
Version: 0.1CC: paji
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-17 06:59:33 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:
Bug Depends On:    
Bug Blocks: 456550    

Description Michael Mráka 2008-07-17 14:31:46 UTC
Description of problem:
Removing an installed package from ~7.300 systems lasts about 1 hour.
During this period system is unresponsive and heavy load is caused by oracle 
database.

As confirmed by statspack, the offending query is packages_from_server_set 
where it's trying to get a list of all packages from the selected systems.

/usr/lib/perl5/site_perl/5.8.5/RHN/DB/DataSource/xml/Package_queries.xml
...
<mode name="packages_from_server_set">
  <query params="user_id, set_label">
SELECT   PN.ID || '|' || PE.ID AS ID,
         PN.ID AS pn_id,
         PE.ID AS pe_id,
         PN.NAME,
         PE.VERSION,
         PE.release,
         PE.epoch,
         X.num_systems
    FROM rhnPackageName PN,
         rhnPackageEVR PE,
         (SELECT   SP.name_id,
                   SP.evr_id,
                   SP.package_arch_id,
                   COUNT (DISTINCT SP.server_id) num_systems
          FROM     rhnServerPackage SP,
                   rhnSet S,
                   rhnPackageArch PA,
                   rhnArchType AT
          WHERE    s.user_id = :user_id
          AND      s.label = :set_label
          AND      s.ELEMENT = SP.server_id
          AND      (   SP.package_arch_id IS NULL
                      OR EXISTS (
                                 SELECT 1
                                   FROM rhnPackageArch PA,
                                        rhnArchType AT
                                  WHERE PA.id = SP.package_arch_id
                                    AND AT.id = PA.arch_type_id
                                    AND (   AT.label = 'rpm'
                                         OR AT.label =
'sysv-solaris')))
          GROUP BY SP.name_id, SP.evr_id, SP.package_arch_id) X
   WHERE PE.ID = X.evr_id
     AND PN.ID = X.name_id
ORDER BY UPPER (PN.NAME)
  </query>
</mode>
...



Version-Release number of selected component (if applicable):
rhn-base-0.1-3

Comment 1 Michael Mráka 2008-07-17 14:34:13 UTC
More detailed description in private bug 453289.

Comment 2 Michael Mráka 2008-07-17 14:59:55 UTC
Fixed in git.
commit 3d201fa4c794e09fc1cb21d3fc45241964b57477

Comment 4 Miroslav Suchý 2009-09-17 06:59:33 UTC
Spacewalk is released for long time.