Bug 1320119

Summary: Schema upgrade to nightly failed
Product: [Community] Spacewalk Reporter: Jiri Precechtel <jprecech>
Component: InstallationAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.4CC: tkasparek, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-16 07:33:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1310034, 1484117    

Description Jiri Precechtel 2016-03-22 10:49:55 UTC
Description of problem:
Upgrade of schema fails when upgrading to spacewalk nightly

Steps to Reproduce:
1. have installed Spacewalk 2.4
2. enable spacewalk nightly repo
3. update spacewalk-schema package
4. execute command spacewalk-schema-upgrade

Actual results:
# spacewalk-schema-upgrade 
Schema upgrade: [spacewalk-schema-2.4.24-1.el7] -> [spacewalk-schema-2.5.19-1.el7]
Searching for upgrade path: [spacewalk-schema-2.4.24-1] -> [spacewalk-schema-2.5.19-1]
Searching for upgrade path: [spacewalk-schema-2.4.24] -> [spacewalk-schema-2.5.19]
Searching for upgrade path: [spacewalk-schema-2.4] -> [spacewalk-schema-2.5]
The path: [spacewalk-schema-2.4] -> [spacewalk-schema-2.5]
Planning to run spacewalk-sql with [/var/log/spacewalk/schema-upgrade/20160322-061140-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/20160322-061140-to-spacewalk-schema-2.5.log].
Upgrade failed, please see log [/var/log/spacewalk/schema-upgrade/20160322-061140-to-spacewalk-schema-2.5.log].

Additional info:
Part of log file containing error:

                                          ?column?
--------------------------------------------------------------------------------------------
 spacewalk-schema-2.4-to-spacewalk-schema-2.5/167-remove_virt_sub_level_refs.sql.postgresql
(1 řádka)

DELETE 1
DELETE 1
psql:/var/log/spacewalk/schema-upgrade/20160322-061140-script.sql:9331: ERROR:  update or delete on table "rhnvirtsublevel" violates foreign key constraint "rhn_cfvsl_vslid_fk" on table "rhnchannelfamilyvirtsublevel"
DETAIL:  Key (id)=(1) is still referenced from table "rhnchannelfamilyvirtsublevel".

RHEL 7 channel synced.

Comment 1 Jiri Precechtel 2016-04-14 15:27:06 UTC
Fixed: Added script to delete corresponding data in referenced table (rhnchannelfamilyvirtsublevel) at first.

Spacewalk-git-commit: 130e11fe3ae9173877853a6f296d1529de6217fa

Comment 4 Tomáš Kašpárek 2016-06-16 07:33:00 UTC
Spacewalk 2.5 was released.

Comment 5 Eric Herget 2017-09-28 18:06:12 UTC
This BZ closed some time during 2.5, 2.6 or 2.7.  Adding to 2.7 tracking bug.