Bug 620724 - [db-upgrade] 2.91 -> 2.92 fails
Summary: [db-upgrade] 2.91 -> 2.92 fails
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: RHQ Project
Classification: Other
Component: Build System   
(Show other bugs)
Version: 4.0.0
Hardware: All
OS: Linux
low
medium vote
Target Milestone: ---
: ---
Assignee: Charles Crouch
QA Contact: Mike Foley
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: jon30-bugs
TreeView+ depends on / blocked
 
Reported: 2010-08-03 10:26 UTC by Lukas Krejci
Modified: 2015-02-01 23:26 UTC (History)
2 users (show)

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


Attachments (Terms of Use)

Description Lukas Krejci 2010-08-03 10:26:26 UTC
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 12:46:45 UTC
Git history shows Joe as the one who committed db.upgrade rev2.92

Comment 2 Joseph Marques 2010-08-11 13:23:32 UTC
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 14:39:43 UTC
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 14:11:46 UTC
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.