Bug 973615 - RHN - Clear Subscription Procedure calling update_family_counts twice
RHN - Clear Subscription Procedure calling update_family_counts twice
Status: CLOSED CURRENTRELEASE
Product: Red Hat Network
Classification: Red Hat
Component: RHN/Maintenance (Show other bugs)
MR51 (AMS)
Unspecified Unspecified
high Severity medium
: ---
: ---
Assigned To: Jonathon Turel
David Spalding
https://url.corp.redhat.com/chg02023
CHG2023
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-12 06:56 EDT by vikas kumar
Modified: 2015-01-19 19:14 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-02 13:42:02 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description vikas kumar 2013-06-12 06:56:27 EDT
Description of problem:

1) Clear Subscription Procedure calling update_family_counts twice

   

a) clear_subscriptions calls unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server) at line 549. unsubscribe_server calls  rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val); at line 666.


b) clear_subscriptions calls rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id); at line 551.


clear_subscriptions is located in http://git.corp.redhat.com/cgit/rhn/rhn/tree/schema/rhn/packages/RHN_CHANNEL.pkb at line number 536.

Solution :- Remove the call b) at line 551 since it is effectively done in unsubscribe_server.
Version-Release number of selected component (if applicable):


How reproducible:
This if for performence improvement on RHN DB side. 

Steps to Verify:
1. go to RHN systems UI. 
2.select a bunch of systems.
3.delete them via system set manager
4.At the same time try to regiter a system for same org via command line.
5.You should be able to successfully acheive it. 

*You should also try to delete a single system.
* You should also be able to change the base channel for a system.
Comment 1 Jonathon Turel 2013-06-19 13:47:11 EDT
Deployed to dev2.

Recommended testing approach:

1. Register a system to rhn dev2:

rhnreg_ks --username <user> --password <pass> --serverUrl http://xmlrpc.ams-rhn-dev2.devlab.phx1.redhat.com/XMLRPC --force

2. Get the system id: less /etc/sysconfig/rhn/systemid (do not include ID-)

3. Use system_id in the following query to find the Channel Family of the Base Channel for that system:

select id, label from rhn.rhnChannelFamily
where id = (select channel_family_id from rhn.rhnChannelFamilyMembers where channel_id = (select channel_id from rhn.rhnServerChannel where server_id = &server_id));

4. Find the consumption of entitlements for that user's org for that channel family:

select * from rhn.rhnPrivateChannelFamily where channel_family_id = &cf_id and org_id = &org_id;

Note the current_members and max_members.

The current_members should decrease when the system is
A) deleted from the RHN UI
B) the server's base channel is changed to one in a different channel family
Comment 2 Derek Brown 2013-06-19 13:53:39 EDT
code review is complete
Comment 3 David Spalding 2013-06-21 16:12:06 EDT
Tested good on AMS-RHN-DEV2:

https://tcms.engineering.redhat.com/run/68636/?from_plan=9552
Comment 4 David Spalding 2013-06-24 12:17:16 EDT
Tested good on QA: 

https://tcms.engineering.redhat.com/run/68675/?from_plan=9552
Comment 5 David Spalding 2013-07-03 11:57:05 EDT
Retested good in QA:

https://tcms.engineering.redhat.com/run/68675/
Comment 6 David Spalding 2013-08-02 13:42:02 EDT
CHG002023 released to Production 7/13

https://url.corp.redhat.com/chg2023

Note You need to log in before you can comment on or make changes to this bug.