Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 973615 - RHN - Clear Subscription Procedure calling update_family_counts twice
Summary: RHN - Clear Subscription Procedure calling update_family_counts twice
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Network
Classification: Retired
Component: RHN/Maintenance
Version: MR51 (AMS)
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
Assignee: Jonathon Turel
QA Contact: David Spalding
URL: https://url.corp.redhat.com/chg02023
Whiteboard: CHG2023
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-12 10:56 UTC by vikas kumar
Modified: 2015-01-20 00:14 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-02 17:42:02 UTC


Attachments (Terms of Use)

Description vikas kumar 2013-06-12 10:56:27 UTC
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 17:47:11 UTC
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 17:53:39 UTC
code review is complete

Comment 3 David Spalding 2013-06-21 20:12:06 UTC
Tested good on AMS-RHN-DEV2:

https://tcms.engineering.redhat.com/run/68636/?from_plan=9552

Comment 4 David Spalding 2013-06-24 16:17:16 UTC
Tested good on QA: 

https://tcms.engineering.redhat.com/run/68675/?from_plan=9552

Comment 5 David Spalding 2013-07-03 15:57:05 UTC
Retested good in QA:

https://tcms.engineering.redhat.com/run/68675/

Comment 6 David Spalding 2013-08-02 17:42:02 UTC
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.