Bug 1373819 - there are differences between upgraded 5.6 to 5.7 and installed 5.7 db schema
Summary: there are differences between upgraded 5.6 to 5.7 and installed 5.7 db schema
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades
Version: 570
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Ales Dujicek
URL:
Whiteboard:
Depends On:
Blocks: sat5-errata sat580-upgrades
TreeView+ depends on / blocked
 
Reported: 2016-09-07 08:16 UTC by Ales Dujicek
Modified: 2017-06-21 12:14 UTC (History)
2 users (show)

Fixed In Version: rhn-upgrade-5.8.0.11-1-sat satellite-schema-5.8.0.23-1-sat spacewalk-schema-2.5.1-31-sat
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-21 12:14:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ales Dujicek 2016-09-07 08:16:12 UTC
Description of problem:

There are differences between database schema of
 * 5.6 Satellite upgraded to 5.7
and
 * new installation of 5.7 Satellite


Version-Release number of selected component (if applicable):
spacewalk-schema-2.3.2-16
satellite-schema-5.7.0.11-1
rhn-upgrade-5.7.0.33-1

How reproducible:
always

Steps to Reproduce:
1. install Satellite 5.6, install rhn-upgrade, follow instructions and upgrade to 5.7
2. and install Satellite 5.7
3. spacewalk-sql -i
--to see differences in db

Actual results:

A) rhnChildChannelArchCompat: channel-aarch64
B) rhnActionType: clientcert.update_client_cert
C) rhnTaskoRun: rhn_tasko_run_template_fk
D) rhnServerPackageArchCompat, rhnServerArch, rhnPackageArch: armv6hl
E) procedure execute


A) select ca.name, cb.name
  from rhnchannelarch ca, rhnchannelarch cb, rhnChildChannelArchCompat ccac
  where ca.id = ccac.child_arch_id and cb.id = ccac.parent_arch_id;
upgraded 5.6 -> 5.7: 24 rows

installed 5.7 sat: 25 rows
contains extra
AArch64       | AArch64


satellite-schema contains
insert into rhnChildChannelArchCompat (parent_arch_id, child_arch_id)
values (LOOKUP_CHANNEL_ARCH('channel-aarch64'), LOOKUP_CHANNEL_ARCH('channel-aarch64'));
in
schema/satellite/schema-override/data/common/rhnChildChannelArchCompat.sql

but upgrade script
schema/satellite/upgrade/spacewalk-schema-2.2-to-spacewalk-schema-2.3/009-rhnChildChannelArchCompat.sql.postgresql.override
does not

and there is also one aarch64 related record in rhnServerPackageArchCompat
package_arch | server_arch
noarch  | aarch64



B) select label, name from rhnActionType;
upgraded 5.6 -> 5.7: 51 rows
contains extra
clientcert.update_client_cert | Update Client Certificate

installed 5.7 sat: 50 rows

upgarde script
schema/spacewalk/upgrade/spacewalk-schema-2.1-to-spacewalk-schema-2.2/021-rhnActionType-clientcert.sql
contains
insert
  into rhnActionType
values (51, 'clientcert.update_client_cert', 'Update Client Certificate', 'N', 'Y');

it is also in
schema/spacewalk/common/data/rhnActionType.sql

but there is an override
schema/satellite/schema-override/data/common/rhnActionType.sql
which does not contain it


C) \d rhnTaskoRun
upgraded 5.6 -> 5.7:
"rhn_tasko_run_template_fk" FOREIGN KEY (template_id) REFERENCES rhntaskotemplate(id) ON DELETE CASCADE

installed 5.7 sat:
"rhn_tasko_run_template_fk" FOREIGN KEY (template_id) REFERENCES rhntaskotemplate(id)


there is upgrade override
satellite/upgrade/sql/001-rhnPackageKey-Fedora-21.sql.oracle.override
which changes that
alter table rhntaskorun drop constraint rhn_tasko_run_template_fk;
alter table rhntaskorun add constraint rhn_tasko_run_template_fk foreign key (template_id) references rhntaskotemplate (id) on delete cascade;


D) select name from rhnPackageArch;
upgraded 5.6 -> 5.7: 45 rows
installed 5.7 sat: 44 rows

select name from rhnServerArch;
upgraded 5.6 -> 5.7: 32 rows
installed 5.7 sat: 31 rows

there is extra ARMv6hl arch which was added to upgrade
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/036-armv6hl.sql
but it is not in schema overrides
schema/satellite/schema-override/data/common/rhnServerArch.sql
schema/satellite/schema-override/data/common/rhnPackageArch.sql

and there are also related records in rhnServerPackageArchCompat missing:
select count(*) from rhnServerPackageArchCompat;
upgraded 5.6 -> 5.7: 136 rows
installed 5.7 sat: 132 rows




E) function execute
upgraded 5.6 -> 5.7: there is execute function
installed 5.7 sat: there is not

some upgrade scripts contains
CREATE OR REPLACE FUNCTION execute(TEXT) RETURNS VOID AS $$
BEGIN EXECUTE $1; END;
$$ LANGUAGE plpgsql STRICT;

e.g
schema/satellite/upgrade/satellite-schema-5.6.0.18-to-satellite-schema-5.6.0.19/001-rhnServerNeededCache-channel_id.sql.postgresql



Expected results:
the same content in rhnActionType, rhnPackageArch, rhnServerArch, rhnServerPackageArchCompat, rhnChildChannelArchCompat tables

I think differences described in (C) and (E) are not- just noted for the record


Additional info:

Comment 1 Ales Dujicek 2016-09-07 11:41:31 UTC
one more thing

F) select a1.label l1, a2.label l2
from rhnPackageUpgradeArchCompat, rhnPackageArch a1, rhnPackageArch a2
where package_arch_id = a1.id
and package_upgrade_arch_id = a2.id and (a1.label = 'ppc64le' or a2.label = 'ppc64le');

upgraded 5.6 -> 5.7: 2 rows
installed 5.7 sat: 3 rows

there is
insert into rhnPackageUpgradeArchCompat (package_arch_id, package_upgrade_arch_id, created, modified) select LOOKUP_PACKAGE_ARCH('ppc64le'), LOOKUP_PACKAGE_ARCH('ppc64le'), current_timestamp, current_timestamp from dual
where not exists (select 1 from rhnPackageUpgradeArchCompat where package_arch_id = LOOKUP_PACKAGE_ARCH('noarch') and package_upgrade_arch_id = LOOKUP_PACKAGE_ARCH('ppc64le'));
in
schema/spacewalk/upgrade/spacewalk-schema-2.2-to-spacewalk-schema-2.3/003-add-ppc64le.sql

which tries to insert
ppc64le - ppc64le
where not exists
noarch - ppc64le
and it exists, so ppc64le - ppc64le is not inserted and then is missing in upgraded schema

Comment 2 Tomas Lestach 2016-09-08 14:46:16 UTC
I do not think all the listed differences are valid (I suppose the architectures may have been added by satellite-sync), but I think the bug is definitely worth investigating.

Comment 3 Tomáš Kašpárek 2016-12-05 13:09:38 UTC
FYI differences between 5.7->5.8 and clean 5.8 should be sorted out.


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