Bug 536378 (RHQ-733) - Upgrade from 2.0.0 to 2.1.0 fails with postgres
Summary: Upgrade from 2.0.0 to 2.1.0 fails with postgres
Keywords:
Status: CLOSED NEXTRELEASE
Alias: RHQ-733
Product: RHQ Project
Classification: Other
Component: Installer
Version: 1.1pre
Hardware: All
OS: All
high
medium
Target Milestone: ---
: ---
Assignee: Jason Dobies
QA Contact: Jeff Weiss
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On:
Blocks: RHQ-666
TreeView+ depends on / blocked
 
Reported: 2008-08-13 20:53 UTC by Jeff Weiss
Modified: 2014-11-09 22:50 UTC (History)
1 user (show)

Fixed In Version: 1.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
linux, postgres
Last Closed:
Embargoed:
jweiss: archived+


Attachments (Terms of Use)

Description Jeff Weiss 2008-08-13 20:53:00 UTC
Installing 2.1.0 build 6170, against a db from 2.0.0, results in the following error

Failed to save properties and fully deploy - JON Server will not function proper
ly Cause: java.lang.RuntimeException:Cannot run ANT on script [/usr/local/jon/se
rver/logs/db-upgrade.xml]. Cause: /usr/local/jon/server/logs/db-upgrade.xml:33: 
Failed to upgrade - error in spec version [2.4]. Cause: Error executing the task
 [org.rhq.core.db.ant.dbupgrade.SST_AlterColumn] in schema spec version [2.4]. C
ause: Failed to alter column. Cause: org.postgresql.util.PSQLException: ERROR: c
olumn "supports_architecture" contains null values -> org.apache.tools.ant.Build
Exception:Failed to upgrade - error in spec version [2.4]. Cause: Error executin
g the task [org.rhq.core.db.ant.dbupgrade.SST_AlterColumn] in schema spec versio
n [2.4]. Cause: Failed to alter column. Cause: org.postgresql.util.PSQLException
: ERROR: column "supports_architecture" contains null values -> org.apache.tools
.ant.BuildException:Failed to upgrade - error in spec version [2.4]. Cause: Erro
r executing the task [org.rhq.core.db.ant.dbupgrade.SST_AlterColumn] in schema s
pec version [2.4]. Cause: Failed to alter column. Cause: org.postgresql.util.PSQ
LException: ERROR: column "supports_architecture" contains null values -> org.ap
ache.tools.ant.BuildException:Error executing the task [org.rhq.core.db.ant.dbup
grade.SST_AlterColumn] in schema spec version [2.4]. Cause: Failed to alter colu
mn. Cause: org.postgresql.util.PSQLException: ERROR: column "supports_architectu
re" contains null values -> org.apache.tools.ant.BuildException:Failed to alter 
column. Cause: org.postgresql.util.PSQLException: ERROR: column "supports_archit
ecture" contains null values -> org.postgresql.util.PSQLException:ERROR: column 
"supports_architecture" contains null values[SQLException=ERROR: column "support
s_architecture" contains null values]

Comment 1 Jason Dobies 2008-08-14 16:00:10 UTC
Here is what I believe to be the issue.

- During 2.0.0 startup, package type metadata loaded. It does *not* contain the supports architecture attribute at this point.
- In the upgrade to 2.0.1, the DB column is added for supports architecture. For existing package types, this is just left at null.
- Also in the upgrade, the second statement runs to set supports architecture to not null. This blows up when there are existing package types.
- In theory, once the package type metadata is read again, we'll have values for supports architecture on all package types (either explicitly set or defaulted). The new metadata should be merged with the existing package types and correctly set this flag on all existing package types.

There are two options:
- Remove the "not null" clause on this column, which will let the upgrade proceed. This column will still be populated on server start when the package types are read.
- Set the supports architecture flag on all existing package types in the upgrade to the default value. The correct values should still be populated when the package types are read at server startup.

The latter would be better as it maintains the DB integrity. I just need to make sure our metadata parsing will correctly merge the package type metadata and update this flag.

Comment 2 Jason Dobies 2008-08-14 19:19:48 UTC
r1241 - db-upgrade.xml
- Default the supports architecture flag for existing package types in an upgrade so the not null directive isn't violated by existing data.

Comment 3 Jeff Weiss 2008-08-21 18:11:39 UTC
This is fixed on my rev1250 build.

Comment 4 Red Hat Bugzilla 2009-11-10 21:15:49 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-733



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