Bug 768031

Summary: Pin template failure on upgraded dbs.
Product: [Other] RHQ Project Reporter: Jay Shaughnessy <jshaughn>
Component: driftAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: urgent Docs Contact:
Priority: high    
Version: 4.3   
Target Milestone: ---   
Target Release: RHQ 4.3.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 4.3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 786294 (view as bug list) Environment:
Last Closed: 2013-09-01 10:14:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 751778    
Bug Blocks: 707225, 760116, 786294    

Description Jay Shaughnessy 2011-12-15 15:09:41 UTC
Upgrades from RHQ 4.1 to RHQ 4.3-SNAPSHOT are hitting the following
exception when tryng to pin a template:

-ERROR: null value in column "drift_definition_id" violates not-null constraint

Comment 2 Jay Shaughnessy 2011-12-15 15:22:18 UTC
The issue here is that the db upgrade is leaving an unwanted NOT NULL
constraint in the db.

The problem can be resolved by applying the following SQL manually:


Postgres:

  Alter Table RHQ_DRIFT_CHANGE_SET Alter Column DRIFT_DEFINITION_ID Drop Not Null

Oracle:

  Alter Table RHQ_DRIFT_CHANGE_SET Modify DRIFT_DEFINITION_ID null

Comment 3 Jay Shaughnessy 2011-12-15 18:53:05 UTC
master commit 638de1b71e5eb15b137ca2deda01299a30f5482c

Set RHQ_DRIFT_CHANGE_SET.DRIFT_DEFINITION_ID nullable in the db upgrade.


Also, this is a supporting commit:

commit 4da6f3724d6492ae449ea76100aac8d9948f6303

- Fix a long standing issue in dbupgrade due to Oracle throwing exceptions
  when trying to set nullable to the current value. In other words, the
  upgrade would fail on oracle if you tried to set nullable false on a
  column that was already nullable false. (same for nullable true). This
  caused issues when you can't guarantee the current state, you just know
  what you need it to be.  Now, catch the relevant exceptions and toss
  them as needed.


Test Notes
This problem only happens when upgrading from RHQ 4.1 to 4.3.

Comment 5 Mike Foley 2011-12-16 15:03:32 UTC
blocked by 751778

Comment 6 Charles Crouch 2012-01-31 23:40:21 UTC
Commits in this BZ were made into master so setting target version to RHQ4.3

Comment 7 Heiko W. Rupp 2013-09-01 10:14:30 UTC
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.