Migration from SUSE Manager 4.1 to 4.2 fails in database schema upgrade with a psql error about "check constraint rhn_errata_adv_status_ck of relation rhnerrata is violated by some row"
This document (000020616) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Manager 4.1
Situation
# spacewalk-schema-upgrade Found unfinished schema migration Try to continue schema migration Planning to run schema upgrade with dir '/var/log/spacewalk/schema-upgrade/schema-from-20220209-002047' Hit Enter to continue or Ctrl+C to interrupt: Executing spacewalk-sql, the log is in [/var/log/spacewalk/schema-upgrade/schema-from-20220209-002047-to-susemanager-schema-4.2.19.log]. (1/43) apply upgrade [susemanager-schema-4.2.9-to-susemanager-schema-4.2.10/010-errata-status.sql.postgresql] Upgrade failed, please see log [/var/log/spacewalk/schema-upgrade/schema-from-20220209-002047-to-susemanager-schema-4.2.19.log]. You can fix the failed migration in [/var/log/spacewalk/schema-upgrade/schema-from-20220209-002047] and run spacewalk-schema-upgrade again"
Resolution
This is only possible in this very special case as the same migration is executed later again with the correct values.
$> cd /var/log/spacewalk/schema-upgrade/schema-from-20220209-002047
there should be a symlink which has a name like the following one:
XXX_010-errata-status.sql.postgresql
It should be the first one in the list. The symlink should be removed:
$> rm <symlink name>
After this, running the schema migration again should work:
$> spacewalk-schema-upgrade
Cause
When a patch with status pending is synced and a migration from 4.1 to 4.2 happens, a check constraint violation will be triggered.
Status
Additional Information
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000020616
- Creation Date: 16-Mar-2022
- Modified Date:16-Mar-2022
-
- SUSE Manager Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com