This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

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 06:14:30 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On: 751778    
Bug Blocks: 707225, 760116, 786294    

Description Jay Shaughnessy 2011-12-15 10:09:41 EST
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 10:22:18 EST
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 13:53:05 EST
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 10:03:32 EST
blocked by 751778
Comment 6 Charles Crouch 2012-01-31 18:40:21 EST
Commits in this BZ were made into master so setting target version to RHQ4.3
Comment 7 Heiko W. Rupp 2013-09-01 06:14:30 EDT
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.