Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1576002 - Satellite 5.8 Fails During schema upgrade to
Summary: Satellite 5.8 Fails During schema upgrade to
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades
Version: 580
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Ales Dujicek
Depends On:
Blocks: sat58-errata
TreeView+ depends on / blocked
Reported: 2018-05-08 14:10 UTC by Diogo Henrique
Modified: 2021-06-10 16:06 UTC (History)
7 users (show)

Fixed In Version: satellite-schema-
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-07-11 15:48:58 UTC
Target Upstream Version:

Attachments (Terms of Use)
schema-upgrade-to- (688 bytes, patch)
2018-05-09 12:49 UTC, Tomáš Kašpárek
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:2174 0 None None None 2018-07-11 15:49:08 UTC

Description Diogo Henrique 2018-05-08 14:10:49 UTC
Description of problem:

When doing the update to schema version, schema upgrade breaks with error message: 

(1 row)

Version-Release number of selected component (if applicable):

How reproducible:

Run a spacewalk-schema-upgrade on Satellite to upgrade to

Steps to Reproduce:
1. Ensure the schema version is
2. Ensure the packages are updated and run spacewalk-schema-upgrade
3. The schema upgrade process will stop and break

Actual results:

Schema upgrade breaking

Expected results:

Schema upgrade finish without any problem

Additional info:

We believe the upgrade is hanging at this loop:

     for nevra_dup in select id
                from rhnpackagenevra
               where evr_id = duplicate.id loop
        delete from rhnsnapshotpackage where nevra_id = nevra_dup.id and snapshot_id in (select snapshot_id from rhnsnapshotpackage where nevra_id = nevra_orig.id intersect select snapshot_id from rhnsnapshotpackage where nevra_id = nevra_dup.id);
        update rhnsnapshotpackage set nevra_id = nevra_orig.id where nevra_id = nevra_dup.id;  <-==== HGERE
      end loop;

(1 row):

psql:/var/log/spacewalk/schema-upgrade/20180503-210515-script.sql:57: ERROR:  null value in column "nevra_id" violates not-null constraint
DETAIL:  Failing row contains (938173, null).
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 28 at SQL statement

A possible test at database level, can be:

	update rhnsnapshotpackage set nevra_id = nevra_orig.id where nevra_id = nevra_dup.id and nevra_orig.id is not NULL;

   The key point is to find why that value is coming NULL (if is expected or not) and then make the PL/SQL to handle it correctly. 

We do have two reproducers, one for before the upgrade and one after:

petroleomayfive.usersys.redhat.com  -->
sys login: root/redhat
web login: satadmin/redhat

petroleomaythree.usersys.redhat.com  -->
sys login: root/redhat
web login: satadmin/redhat

MAY 3 - Before Schema Upgrade
MAY 5 - After the Schema Upgrade

Case 02091975 Has all history and information of job done trought this environment

Comment 4 Tomáš Kašpárek 2018-05-09 12:49:44 UTC
Created attachment 1433807 [details]

Comment 7 Tomáš Kašpárek 2018-05-23 09:35:13 UTC
spacewalk.git(master): 4898dc4cfc0d3af7488c60ed93f0d7b4da32dcb0

Comment 12 errata-xmlrpc 2018-07-11 15:48:58 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.


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