Hide Forgot
Created attachment 1138805 [details] Platform-independent version of schema upgrade script 013-rhnResetPassword.sql Description of problem: After an upgrade to Spacewalk 2.4, unable to add new users Version-Release number of selected component (if applicable): Spacewalk 2.4 (and 2.5) after upgrade from 2.3 How reproducible: Always Steps to Reproduce: 1. Install Spacewalk 2.3 2. Upgrade to Spacewalk 2.4 3. Create new user Actual results: - User is not created - "Internal server error" message in web UI - Trace message with key contents "Caused by: com.redhat.rhn.common.db.WrappedSQLException: ERROR: relation "rhnresetpassword" does not exist" Expected results: User is added Additional info: Culprit appears to be file 013-rhnResetPassword.sql in the spacewalk-schema-2.3-to-spacewalk-schema-2.4 script collection. File as distributed has some Oracle-specific syntax that is not parsed by PGSQL. Attached version of the file has been corrected for PGSQL and verified to fix the problem.
Forgot to include in description and steps that this is with PostgreSQL backend database.
Did you run spacewalk-schema-upgrade after upgrade to Spacewalk 2.4?
(In reply to Jan Dobes from comment #2) > Did you run spacewalk-schema-upgrade after upgrade to Spacewalk 2.4? Yes, multiple times, with roll-back-and-retry each time that I got this error and even a roll-back to a 2.2 backup and then upgrade through the sequence to 2.4. Ran spacewalk-schema-upgrade each time and always got the same result. Without upgrading the schema from 2.3 to 2.4 adding users works fine, but there's the warning at the login screen about needing to upgrade the schema. If spacewalk-schema-upgrade is not run after doing the package upgrades nothing breaks. It only breaks when the invalid schema upgrade is applied and the rhnResetPassword table is not created.
When you run spacewalk-schema-upgrade, there is a path to the sql script that will do the upgrade. Is code creating rhnResetPassword table (from 013-* upgrade) in this file? Is table in database after upgrade? (check with spacewalk-sql -i <<< "\d rhnResetPassword")
As I have run my fixed version of the script and now have changes in place I am unwilling to roll back and upgrade again, but looking at the .sql files generated by spacewalk-schema-upgrade shows me no mention of rhnResetPassword: [root@spacewalk schema-upgrade]# pwd /var/log/spacewalk/schema-upgrade [root@spacewalk schema-upgrade]# grep -i rhnresetpassword * [root@spacewalk schema-upgrade]# I did look through the full schema after the last upgrade that didn't work and the rhnResetPassword table was not present. When I ran my corrected version of 013-rhnResetPassword.sql there was no failure related to that table existing.
I've tested that Spacewalk 2.2 schema can be upgraded to 2.9 schema: # /usr/bin/spacewalk-schema-upgrade Please make sure all Spacewalk services apart from database are stopped. Schema upgrade: [spacewalk-schema-2.2.32-1.el6] -> [spacewalk-schema-2.9.11-1.el6] Searching for upgrade path: [spacewalk-schema-2.2.32-1] -> [spacewalk-schema-2.9.11-1] Searching for upgrade path: [spacewalk-schema-2.2.32] -> [spacewalk-schema-2.9.11] Searching for upgrade path: [spacewalk-schema-2.2] -> [spacewalk-schema-2.9] The path: [spacewalk-schema-2.2] -> [spacewalk-schema-2.3] -> [spacewalk-schema-2.4] -> [spacewalk-schema-2.5] -> [spacewalk-schema-2.6] -> [spacewalk-schema-2.7] -> [spacewalk-schema-2.8] -> [spacewalk-schema-2.9] Planning to run spacewalk-sql with [/var/log/spacewalk/schema-upgrade/20190704-167850-script.sql] Please 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/20190704-167850-to-spacewalk-schema-2.9.log]. The database schema was upgraded to version [spacewalk-schema-2.9.11-1.el6]. Because we are not able to reproduce the issue I'm closing the bug. If you disagree feel free to update the reproducer and reopen the bug.