Bug 1402935 - [5.8] lock_counts fix has several issues
Summary: [5.8] lock_counts fix has several issues
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 580
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
Assignee: Grant Gainey
QA Contact: Jan Hutař
URL:
Whiteboard:
Depends On: 1402931
Blocks: 1340444 1402933
TreeView+ depends on / blocked
 
Reported: 2016-12-08 16:34 UTC by Grant Gainey
Modified: 2017-06-27 18:04 UTC (History)
8 users (show)

Fixed In Version: spacewalk-schema-2.5.1-26-sat, satellite-schema-5.8.0.18-1-sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1402931
Environment:
Last Closed: 2017-06-21 12:18:52 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1458880 None None None Never

Internal Links: 1458880

Description Grant Gainey 2016-12-08 16:34:45 UTC
+++ This bug was initially created as a clone of Bug #1402931 +++

Description of problem:

The Oracle version of lock_counts.pkb fails to lock the server-row 'for update', which kind of defeats the whole purpose iof the proc.  Fix this.

Comment 3 Grant Gainey 2016-12-16 21:22:58 UTC
There is a further hole in the erratum that released lock_counts - specifically, the unsubscribe_server path WAS NOT COVERED, in either postgresql or oracle.

This is fixed in rhn_channel.pkb in both dialects.

Comment 5 Ales Dujicek 2016-12-22 08:06:11 UTC
There is diff between new 5.8 schema and 5.7 or older schema upgraded to 5.8 (both postgres an oracle)



Sources in [rhnuser@DBNAME=RHNSCHEMA] and [rhnuser@DBNAME=SPACESCHEMA_BPZS9A]
--- procedure_rhn_channel_subscribe_server_server_id_in_numeric_channel_id_in_numeric_immediate_in_numeric_DEFAULT_1_user_id_in_numeric_DEFAULT_NULL_numeric_recalcfamily_in_numeric_DEFAULT_1_returns_void.1	2016-12-21 12:57:24.143602374 -0500
+++ procedure_rhn_channel_subscribe_server_server_id_in_numeric_channel_id_in_numeric_immediate_in_numeric_DEFAULT_1_user_id_in_numeric_DEFAULT_NULL_numeric_recalcfamily_in_numeric_DEFAULT_1_returns_void.2	2016-12-21 12:57:24.143602374 -0500
@@ -15,8 +15,6 @@
         allowed                 numeric;
         is_fve_char             char(1) := 'N';
     BEGIN
-        perform lock_counts(server_id_in);
-
         if user_id_in is not null then
             allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
         else
@@ -59,6 +57,7 @@
         THEN
             perform rhn_exception.raise_exception('channel_subscribe_no_family');
         END IF;
+        perform lock_counts(server_id_in);
         SELECT COALESCE(org_id, (SELECT org_id FROM rhnServer WHERE id = server_id_in))
           INTO server_org_id_val
           FROM rhnChannel
--- procedure_rhn_channel_unsubscribe_server_server_id_in_numeric_channel_id_in_numeric_immediate_in_numeric_DEFAULT_1_unsubscribe_children_in_numeric_DEFAULT_0_deleting_server_numeric_DEFAULT_0_update_family_countsyn_numeric_DEFAULT_1_returns_void.1	2016-12-21 12:57:24.150602279 -0500
+++ procedure_rhn_channel_unsubscribe_server_server_id_in_numeric_channel_id_in_numeric_immediate_in_numeric_DEFAULT_1_unsubscribe_children_in_numeric_DEFAULT_0_deleting_server_numeric_DEFAULT_0_update_family_countsyn_numeric_DEFAULT_1_returns_void.2	2016-12-21 12:57:24.150602279 -0500
@@ -19,7 +19,6 @@
                     and label = 'rhn-satellite';
         child record;
     BEGIN
-        perform lock_counts(server_id_in);
         FOR child IN select  c.id
                 from    rhnChannel                      c,
                                 rhnServerChannel        sc



Because change in

satellite-schema-5.7-to-satellite-schema-5.8/001-rhn_channel-deadlock-fix.sql.postgresql

is later overwritten by

satellite-schema-5.7-to-satellite-schema-5.8/007-rhn_channel-update_needed_cache-async.sql.postgresql

so it is not applied in upgraded schema.


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