Bug 1542287

Summary: Upgrading database schema to 5.8.0.40 fails due to drop table rhnSolarisPatchedPackage
Product: Red Hat Satellite 5 Reporter: Candace Sheremeta <cshereme>
Component: UpgradesAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED ERRATA QA Contact: Ales Dujicek <adujicek>
Severity: high Docs Contact:
Priority: high    
Version: 580CC: achadha, adujicek, ahumbe, aladke, asahni, gapatil, ggainey, ktordeur, mkalyat, risantam, tlestach, trond, vchepkov, wayne.johnson, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: satellite-schema-5.8.0.42-1-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-06 15:47:02 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1450111    

Description Candace Sheremeta 2018-02-06 00:42:39 UTC
Attempting to upgrade database schema to 5.8.0.40 fails with this message:

~~~
cat /var/log/spacewalk/schema-upgrade/20180205-231809-to-satellite-schema-5.8.0.40.log
UPDATE 1
COMMIT
                                                ?column?                                                 
---------------------------------------------------------------------------------------------------------
 satellite-schema-5.8.0.38-to-satellite-schema-5.8.0.39/001-rhnpackageevr-rhn_pe_v_r_e_uq.sql.postgresql
(1 row)

CREATE FUNCTION
DROP TRIGGER
psql:/var/log/spacewalk/schema-upgrade/20180205-231809-script.sql:58: ERROR:  relation "rhnsolarispatchedpackage" does not exist
LINE 1: update rhnsolarispatchedpackage set package_nevra_id = nevra...
               ^
QUERY:  update rhnsolarispatchedpackage set package_nevra_id = nevra_orig.id where package_nevra_id = nevra_dup.id
CONTEXT:  PL/pgSQL function fix_rhn_pe_v_r_e_uq() line 28 at SQL statement
~~~

This is due to:

~~~
spacewalk/upgrade/spacewalk-schema-2.2-to-spacewalk-schema-2.3/018-drop_solaris_tables.sql:drop table rhnSolarisPatchedPackage;
~~~

This update exists in 38-to-39, but it should not (we shouldn't be referencing Solaris tables at all anymore). 

I was unable to reproduce this issue on a fresh install of Satellite 5.8, so I'm not sure what would need to happen to create a situation where this error occurs, but we have two cases currently open with this issue.

We may also want to drop the mention of rhnsolarispatchpackages from that upgrade script as well.

Comment 1 Tomáš Kašpárek 2018-02-06 08:35:41 UTC
spacewalk.git(master): 4252c4adb8e1750021b7db7ad771c2e05c8cf2b9

Comment 3 achadha 2018-02-09 12:33:40 UTC
Hello,

I have a case where customer has already applied the workaround as per article : https://access.redhat.com/solutions/3344911, however now he is getting some other error related to a different table when he tried to run a schema upgrade

Below are the logs from the same

/var/log/spacewalk/schema-upgrade/20180208-063309-to-satellite-schema-5.8.0.40.log.
------------------------------------------------------------------------

The log file has:

UPDATE 1
COMMIT
                                                ?column?                         
=============================================================================
---------------------------------------------------------------------------------------------------------
 satellite-schema-5.8.0.38-to-satellite-schema-5.8.0.39/001-rhnpackageevr-rhn_pe_v_r_e_uq.sql.postgresql
(1 row)

CREATE FUNCTION
DROP TRIGGER
psql:/var/log/spacewalk/schema-upgrade/20180208-063309-script.sql:56: ERROR:  duplicate key value violates unique constraint "rhn_snapshotpkg_sid_nid_uq"
DETAIL:  Key (snapshot_id, nevra_id)=(33256, 229427) already exists.
CONTEXT:  SQL statement "update rhnsnapshotpackage set nevra_id = nevra_orig.id where nevra_id = nevra_dup.id"
PL/pgSQL function fix_rhn_pe_v_r_e_uq() line 27 at SQL statement
=============================================================================

        rhn-schema-version
                                # Shows nothing
------------------------------------


Thanks and Regards,
Arvinder Singh Chadha

Comment 5 Tomáš Kašpárek 2018-02-13 15:10:59 UTC
spacewalk.git(master): 19fcf010813492ae6c0de4c0ff17aa400dfebe67

Comment 11 errata-xmlrpc 2018-03-06 15:47:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0393