Bug 620724 - [db-upgrade] 2.91 -> 2.92 fails
[db-upgrade] 2.91 -> 2.92 fails
Status: CLOSED INSUFFICIENT_DATA
Product: RHQ Project
Classification: Other
Component: Build System (Show other bugs)
4.0.0
All Linux
low Severity medium (vote)
: ---
: ---
Assigned To: Charles Crouch
Mike Foley
:
Depends On:
Blocks: jon30-bugs
  Show dependency treegraph
 
Reported: 2010-08-03 06:26 EDT by Lukas Krejci
Modified: 2015-02-01 18:26 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-03-02 10:46:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lukas Krejci 2010-08-03 06:26:26 EDT
Description of problem:

The upgrade from schema version 2.91 to version 2.92 failed for me with the following:

[dbupgrade] Upgrading: [2.91] -> [2.92]
[schemaSpec] Executing the task [class org.rhq.core.db.ant.dbupgrade.SST_DirectSQL] in schema spec version [2.92]
[statement] Executing direct SQL. Description=[Upgrading configuration permissions] : SQL=[
[statement]                         INSERT INTO RHQ_PERMISSION (ROLE_ID, OPERATION)
[statement]                         SELECT PERM.ROLE_ID, 13
[statement]                         FROM RHQ_PERMISSION PERM
[statement]                         WHERE PERM.OPERATION = 11
[statement]                     ]
[DEBUG] {DatabaseType.executing-sql}Executing the following SQL: 
                        INSERT INTO RHQ_PERMISSION (ROLE_ID, OPERATION)
                        SELECT PERM.ROLE_ID, 13
                        FROM RHQ_PERMISSION PERM
                        WHERE PERM.OPERATION = 11
                    
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: The following error occurred while executing this line:
/home/metlos/Projects/java/jon/git/rhq/modules/core/dbutils/src/main/scripts/dbsetup-build.xml:282: The following error occurred while executing this line:
/home/metlos/Projects/java/jon/git/rhq/modules/core/dbutils/src/main/scripts/dbsetup-build.xml:306: The following error occurred while executing this line:
/home/metlos/Projects/java/jon/git/rhq/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml:27: Failed to upgrade - error in spec version [2.92]. Cause: Error executing the task [org.rhq.core.db.ant.dbupgrade.SST_DirectSQL] in schema spec version [2.92]. Cause: The schema spec task [DirectSQL] has encountered an error. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "rhq_permission_pk"


Steps to Reproduce:
1. mvn install -Ddb=dev -Ddbsetup-upgrade
  
Actual results:
Can't upgrade the database.

Expected results:
Database upgraded.
Comment 1 Heiko W. Rupp 2010-08-11 08:46:45 EDT
Git history shows Joe as the one who committed db.upgrade rev2.92
Comment 2 Joseph Marques 2010-08-11 09:23:32 EDT
Root cause is:

ERROR: duplicate key value violates unique constraint "rhq_permission_pk"

Any idea how you might have hit that?
Comment 3 Lukas Krejci 2010-08-12 10:39:43 EDT
was there a time when we introduced the new privs in release-3.0.0 and then removed them again? maybe that's how the privs got in in db version < 2.92? which would mean this is a non-issue.
Comment 4 Joseph Marques 2010-08-13 10:11:46 EDT
did you work in two different branches - release and master - and switch back and forth between them?  if so, there's a possibility that schemaSpec X was schemaSpec X+offset in the other branch, which would cause upgrade issues like you're seeing.

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