Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1445404

Summary: [5.7] remove DISTINCT keyword from subscribed server counts when META DATA is fixed
Product: Red Hat Satellite 5 Reporter: Grant Gainey <ggainey>
Component: ServerAssignee: Grant Gainey <ggainey>
Status: CLOSED DUPLICATE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 570CC: ggainey, hartsjc, rcyriac, satqe-list, sgraf, shughes, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1416940 Environment:
Last Closed: 2017-04-25 15:33:39 UTC Type: Bug
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: 1416940    
Bug Blocks:    

Description Grant Gainey 2017-04-25 15:26:41 UTC
+++ This bug was initially created as a clone of Bug #1416940 +++

Description of problem:

this bz will track the fix to remove the DISTINCT that was put into place due to the upstream meta data with the server/channels in bz 1021057. While this fixed the duplicates it introduced a terrible performance penalty for larger Satellite client counts. There is more detail history in a wiki that I will post separately.

--- Additional comment from Shannon Hughes on 2017-01-26 15:45:06 EST ---

problem set history is at https://engineering.redhat.com/trac/satellite/wiki/1021057

--- Additional comment from Shannon Hughes on 2017-01-27 06:21:50 EST ---

for now been using oracle optimizer hints on the rhn_channel.channel_family_current_members function: 

SELECT /*+ FULL(RHNSERVER) OPT_PARAM('_optimizer_mjc_enabled' 'false') OPT_PARAM('_optimizer_cartesian_enabled' 'false')*/ COUNT (DISTINCT SC.SERVER_ID)

Have used this hint successfully for three customers with large Satellite 5.6 and 5.7 external oracle installs

this would turn off the more expensive cartesian joins

--- Additional comment from Grant Gainey on 2017-04-12 14:41:46 EDT ---

SATELLITE-5.8:
67946bbb63ae281a6443234584c086b6bf3a94ad
1215bf7cf5c041e63cebfd47d08b04697752db51
0b77b4e546941392774e895d20917765dcdcc068
f0a57a3e04fd7b7459d50e44cc189e390917e4f4
3e610da34f4b510da067ab7dcf433969789666d5

--- Additional comment from Grant Gainey on 2017-04-12 14:51:43 EDT ---

Following files affected:

backend/satellite_tools/rhn-entitlement-report
backend/satellite_tools/satCerts.py
schema/spacewalk/oracle/packages/rhn_channel.pkb
schema/spacewalk/oracle/packages/rhn_entitlements.pkb
schema/spacewalk/postgres/packages/rhn_channel.pkb
schema/spacewalk/postgres/packages/rhn_entitlements.pkb

NOTE: This affects entitlement-counting. Since we don't do that any more in Spacewalk, *there is no upstream fix*

--- Additional comment from releng-rhel on 2017-04-13 11:05:35 EDT ---

Fixed in 'satellite-schema-5.8.0.26-1'. 'satellite-schema-5.8.0.26-1.el6sat' included in compose 'Satellite-5.8-RHEL-6-20170413.n.0'.
Fixed in 'spacewalk-backend-2.5.3-107'. 'spacewalk-backend-2.5.3-107.el6sat' included in compose 'Satellite-5.8-RHEL-6-20170413.n.0'.
Fixed in 'spacewalk-schema-2.5.1-41'. 'spacewalk-schema-2.5.1-41.el6sat' included in compose 'Satellite-5.8-RHEL-6-20170413.n.0'.
Moving to ON_QA.

Comment 1 Grant Gainey 2017-04-25 15:33:39 UTC
Closing - we already have a BZ open to get this work into 5.7

*** This bug has been marked as a duplicate of bug 1439299 ***