Bug 1427530 - cannot upgrade to 5.8 when solaris base channel has non-solaris child channels
Summary: cannot upgrade to 5.8 when solaris base channel has non-solaris child channels
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades
Version: 580
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Ales Dujicek
URL:
Whiteboard:
Depends On:
Blocks: sat580-upgrades
TreeView+ depends on / blocked
 
Reported: 2017-02-28 14:10 UTC by Ales Dujicek
Modified: 2017-06-21 12:18 UTC (History)
1 user (show)

Fixed In Version: spacewalk-schema-2.5.1-33-sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-21 12:18:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ales Dujicek 2017-02-28 14:10:25 UTC
Description of problem:

Satellite 5.6 (and probably earlier) versions allows you to create child channels of any architecture.

Then removal of solaris channels with x86 and others child channels fails during upgrade.


# spacewalk-schema-upgrade 
Schema upgrade: [satellite-schema-5.6.0.34-1.el6sat] -> [satellite-schema-5.8.0.23-1.el6sat]
Searching for upgrade path: [satellite-schema-5.6.0.34-1] -> [satellite-schema-5.8.0.23-1]
Searching for upgrade path: [satellite-schema-5.6.0.34] -> [satellite-schema-5.8.0.23]
Searching for upgrade path: [satellite-schema-5.6.0] -> [satellite-schema-5.8.0]
Searching for upgrade path: [satellite-schema-5.6] -> [satellite-schema-5.8]
The path: [satellite-schema-5.6] -> [satellite-schema-5.7] -> [satellite-schema-5.8]
Planning to run spacewalk-sql with [/var/log/spacewalk/schema-upgrade/20170228-074126-script.sql]

Plase make sure you have a valid backup of your database before continuing.

Hit Enter to continue or Ctrl+C to interrupt: 
Executing spacewalk-sql, the log is in [/var/log/spacewalk/schema-upgrade/20170228-074126-to-satellite-schema-5.8.log].
Upgrade failed, please see log [/var/log/spacewalk/schema-upgrade/20170228-074126-to-satellite-schema-5.8.log].


/var/log/spacewalk/schema-upgrade/20170228-074126-to-satellite-schema-5.8.log:
psql:/var/log/spacewalk/schema-upgrade/20170228-074126-script.sql:24993: ERROR:  update or delete on table "rhnchannel" violates foreign key constraint "rhn_channel_parent_ch_fk" on table "rhnchannel"
DETAIL:  Key (id)=(650) is still referenced from table "rhnchannel".
CONTEXT:  SQL statement "delete from rhnChannel where id = channel_id_in"
PL/pgSQL function delete_channel(numeric) line 13 at SQL statement
SQL statement "SELECT delete_channel(rec.id)"
PL/pgSQL function delete_channel_tmp(character varying) line 8 at PERFORM

/var/log/spacewalk/schema-upgrade/20170228-074126-script.sql
24991 select delete_channel_tmp_child('channel-sparc-sun-solaris');
24992 select delete_channel_tmp_child('channel-i386-sun-solaris');
24993 select delete_channel_tmp('channel-sparc-sun-solaris');
24994 select delete_channel_tmp('channel-i386-sun-solaris');

It is very unlikely. It makes no sense to create child channels with incompatible architecture but *can happen*.


Note: channel-sparc arch is compatible with solaris on 5.7:
rhnschema=# select a1.label l1, a2.label l2
rhnschema-# from rhnChildChannelArchCompat, rhnChannelArch a1, rhnChannelArch a2
rhnschema-# where parent_arch_id = a1.id
rhnschema-# and child_arch_id = a2.id
rhnschema-# and (a1.label like '%sol%' or a2.label like '%sol%');
            l1             |            l2             
---------------------------+---------------------------
 channel-sparc             | channel-sparc-sun-solaris
 channel-sparc             | channel-i386-sun-solaris
 channel-sparc-sun-solaris | channel-sparc
 channel-sparc-sun-solaris | channel-sparc-sun-solaris
 channel-sparc-sun-solaris | channel-i386-sun-solaris
 channel-i386-sun-solaris  | channel-sparc
 channel-i386-sun-solaris  | channel-sparc-sun-solaris
 channel-i386-sun-solaris  | channel-i386-sun-solaris
(8 rows)
which could cause the same problem - we do not delete channel-sparc arch 


Version-Release number of selected component (if applicable):
satellite-schema-5.8.0.23-1.el6sat.noarch
spacewalk-schema-2.5.1-31.el6sat.noarch
rhn-upgrade-5.8.0.13-1.el6sat.noarch

How reproducible:
always

Steps to Reproduce:
1. install sat 5.6
2. create 
3. upgrade to 5.8
4. schema upgrade

Comment 1 Tomáš Kašpárek 2017-03-02 14:37:53 UTC
spacewalk.git(master): 330047094932426e879c2bf07d41c63604f7402b

Comment 3 Tomáš Kašpárek 2017-03-02 14:53:35 UTC
sha1 fixed in spacewalk.git(master): 7e70cf7f35069d50d7d14b381c612c69fa80d0e2

Comment 7 Ales Dujicek 2017-03-28 11:49:15 UTC
Solaris channels are successfully removed during Sat upgrade
tested with Solaris channels and their child channels
5.5 Oracle -> 5.8 PG upgrade and 5.6 Pg -> 5.8 Pg

-> VERIFIED

rhn-upgrade-5.8.0.14-1.el6sat.noarch
spacewalk-schema-2.5.1-37.el6sat.noarch
satellite-schema-5.8.0.24-1.el6sat.noarch

note: bz1402437


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