Bug 511377 - Schema Upgrade fails on rhnCpuArch i86pc: ORA-00001: unique constraint (RHNSAT.RHN_CPUARCH_LABEL_UQ) violated
Schema Upgrade fails on rhnCpuArch i86pc: ORA-00001: unique constraint (RHNSA...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades (Show other bugs)
530
All Linux
low Severity medium
: ---
: ---
Assigned To: Milan Zázrivec
Jeff Browning
:
Depends On:
Blocks: 456986
  Show dependency treegraph
 
Reported: 2009-07-14 16:52 EDT by John Matthews
Modified: 2009-08-27 13:38 EDT (History)
2 users (show)

See Also:
Fixed In Version: sat530
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-08-27 13:38:46 EDT
Type: ---
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 John Matthews 2009-07-14 16:52:29 EDT
Description of problem:


SQL> set echo on
SQL> spool /var/log/spacewalk/schema-upgrade/20090714-155255-to-satellite-schema-5.3.log append
SQL> whenever sqlerror exit sql.sqlcode
SQL> select 'rhn-satellite-schema-5.2-to-satellite-schema-5.3/100-rhnCpuArch-i86pc.sql' from dual;

'RHN-SATELLITE-SCHEMA-5.2-TO-SATELLITE-SCHEMA-5.3/100-RHNCPUARCH-I86PC.SQ
-------------------------------------------------------------------------
rhn-satellite-schema-5.2-to-satellite-schema-5.3/100-rhnCpuArch-i86pc.sql

SQL> 
SQL> insert into rhnCpuArch (id, label, name) values
  2  (rhn_cpu_arch_id_seq.nextval, 'i86pc', 'i86pc');
insert into rhnCpuArch (id, label, name) values
*
ERROR at line 1:
ORA-00001: unique constraint (RHNSAT.RHN_CPUARCH_LABEL_UQ) violated


Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Upgrade failed, please see log in [/var/log/spacewalk/schema-upgrade/].

Version-Release number of selected component (if applicable):
Original install was: Satellite-5.2.0-RHEL4-re20081028.3-i386-embedded-oracle.iso
Upgraded to: Satellite-5.3.0-RHEL4-re20090713.0-i386-embedded-oracle.iso

satellite-schema-5.3.0.22-1.el4sat
spacewalk-schema-0.5.20-18.el4sat


How reproducible:


Steps to Reproduce:
1. install sat 520 on rhel4 i386 with embedded db
2. sat-sync rhel5 i386 from channel_dumps and rhel5 x86_64 from web_qa
3. upgrade to sat 530 on rhel4 i386 with embedded db
4. ./install.pl --upgrade
5. /usr/sbin/spacewalk-schema-upgrade 
  
Actual results:
Error seen above

Expected results:
Upgrade should work

Additional info:

Brandon has seen this type of problem before he recommends the below as a fix

/etc/sysconfig/rhn/schema-upgrade/spacewalk-0.2-spacewalk-0.3/100-rhnCpuArch-i86pc.sql

which looks like:

insert into rhnCpuArch (id, label, name) values
(rhn_cpu_arch_id_seq.nextval, 'i86pc', 'i86pc');

should look more like our sun4v case like:

insert into rhnCpuArch (id, label, name) (
    select rhn_cpu_arch_id_seq.nextval,
           'i86pc',
           'i86pc'
    from dual
    where not exists (
        select label, name
        from rhnCpuArch
        where label = 'i86pc' and
              name = 'i86pc')
);

example can be found at:  /etc/sysconfig/rhn/schema-upgrade/satellite-5.1-spacewalk-0.2/004-rhnCpuArch_data-solaris-sun4v.sql
Comment 1 John Matthews 2009-07-14 16:53:20 EDT
The scenario described here is from following 1-b
It is a Sat 5.2.0 on RHEL4 i386 -> Sat 5.3.0 on RHEL4 i386
Comment 2 Brandon Perkins 2009-07-14 16:59:24 EDT
This is incredibly similar to bug 506272.
Comment 3 Milan Zázrivec 2009-07-15 02:35:26 EDT
spacewalk.git master: 7e029cca2dd724b92cf8da00789a52875dc0fe20
spacewalk.git VADER: 0e3a9af01f7091111192a8d51aba25cd6099cfe7
Comment 4 Milan Zázrivec 2009-07-18 03:37:43 EDT
ON_QA: spacewalk-schema-0.5.20-20
Comment 5 Jeff Browning 2009-07-22 05:27:54 EDT
Verified. Unique constraint error no longer encountered.
Comment 6 Tomas Lestach 2009-08-21 08:40:11 EDT
Schema upgrade
[rhn-satellite-schema-5.2.0-8] -> [satellite-schema-5.3.0.23-1.el4sat] 
successful.

Stage validated -> RELEASE_PENDING
Comment 7 Brandon Perkins 2009-08-27 13:38:46 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1235.html

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