Bug 751778

Summary: Upgrade from rhq4.1.0 to rhq4.2.0 fails with error : relation "rhq_drift_def_template" does not exist
Product: [Other] RHQ Project Reporter: Sunil Kondkar <skondkar>
Component: Core ServerAssignee: Jay Shaughnessy <jshaughn>
Status: ON_QA --- QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: low    
Version: 4.1CC: hendy, hrupp, jshaughn, loleary
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=753866
Whiteboard:
Fixed In Version: 4.3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 753866    
Bug Blocks: 620931, 768031, 786294    
Attachments:
Description Flags
ServerLog
none
image of upgrade error
none
text of upgrade error
none
log of upgrade error none

Description Sunil Kondkar 2011-11-07 09:41:18 EST
Description of problem:

Upgrading from rhq4.1.0 to rhq4.2.0 on postgres displays below error in server log:
"ERROR: relation "rhq_drift_def_template" does not exist".

After upgrade, clicking on platform name displays mesage "Resource with id [10001] does not exist or is not accessible" in UI and the server log displays the errors "ERROR: relation "rhq_drift_def_template" does not exist".

Please find attached the server log.


Version-Release number of selected component (if applicable):

Java version "1.6.0_18"
Postgres: 8.4.2

How reproducible:

Always

Steps to Reproduce:

1. Install rhq4.1.0.
2. Upgrade to rhq4.2.0.
3. See the server log. It has errors like "ERROR: relation "rhq_drift_def_template" does not exist".
4. After upgrade, navigate to the 'Inventory->Platforms'.
5. Click on the platform.
6. It displays message "Resource with id [10001] does not exist or is not accessible" and error "relation "rhq_drift_def_template" does not exist" in server log.
  
Actual results:

Upgrade from rhq4.1.0 to rhq4.2.0 fails with error "relation "rhq_drift_def_template" does not exist"

Expected results:

Upgrade should succeed.

Additional info:
Comment 1 Sunil Kondkar 2011-11-07 09:41:50 EST
Created attachment 532057 [details]
ServerLog
Comment 2 Hendy Irawan 2011-11-08 07:14:55 EST
I also confirm this issue happening to me, although I'm on PostgreSQL 9.1.
Comment 3 Jay Shaughnessy 2011-11-11 11:40:52 EST
The problem is not immediately obvious, I'll have to suck down the distros and try to recreate...
Comment 4 Jay Shaughnessy 2011-11-11 13:43:06 EST
OK, I finally understand what is wrong with the upgrade from 4.1 to 4.2.
The problem is that we basically forgot about the fact that an initial
drift implementation actually went out with 4.1. As such we continued
to update schema spec 2.111 with data model changes when actually the
4.1 dbs are already at 2.114. So, basically, no schema changes are applied
during a 4.1 to 4.2 upgrade.

We need to revert 2.111 steps to the 4.1 version, and then make 2.115
perform the necessary updates.

working it...
Comment 5 Jay Shaughnessy 2011-11-14 13:02:17 EST
This needed to be addressed for JON3, at least partially.  Given that to
repair the upgrade for the RHQ 4.3 release we need to revert schema
spec 2.111 back to its RHQ 4.1 state, we could not release JON3 with
the current, incorrect, 2.111 even though for JON3 purposes it would
have worked (at least temporarily).  Doing so would have left JON3 dbs
in a broken state for subsequent jon release upgrades.

master         commit: 0034ed67e8d978e4599dfac2fd023ad77ea5a880
release_jon3.x commit: a34c91781076786d01102cd39dd8f828a368bbb3

Test Notes:
RHQ 4.3 db upgrade testing should be performed with fully populated
drift-related data, and should wait until bug 753866 is on_qa (
basically, defer testing until you get on_qa for 753866)

JON3 db upgrade testing should be performed and then all drift testing
should take place on the upgraded db.
Comment 6 Mike Foley 2011-11-18 14:48:22 EST
jon 3 db upgrade testing complete:

libor ---> postgres
mfoley ---> oracle
Comment 7 Mike Foley 2011-11-18 14:49:23 EST
verification blocked by 753866 (per comment #5).

adding depends on 753866
Comment 8 Mike Foley 2011-11-18 14:56:51 EST
verification blocked by 753866 (per comment #5).

adding depends on 753866
Comment 9 Jay Shaughnessy 2011-12-06 17:07:17 EST
There are some more complications with RHQ43 upgrades.  RHQ 4.2 was
released with the wrong schema version (2.114, the same as RHQ 4.1).
This means that new 4.2 installs install a schema that is marked
as schema version 2.114 but whose schema actually reflects 2.115.

So,upgrades (meaning, installs choosing to keep existing data) from 4.1
to 4.2 are broken.  And upgrades from 4.2 to 4.3 are/will be broken.

I think upgrades from 4.1 to 4.3 will work.

Also, if a 4.2 install has its schema version manually updated to 
2.115 then an upgrade to 4.3 may work.

See 753866 for more...
Comment 10 Mike Foley 2011-12-13 11:44:55 EST
...tested RHQ 4.1 upgrade to 4.3.  observed upgrade error.  adding attachments to document the failure.
Comment 11 Mike Foley 2011-12-13 11:45:42 EST
Created attachment 546278 [details]
image of upgrade error
Comment 12 Mike Foley 2011-12-13 11:46:12 EST
Created attachment 546279 [details]
text of upgrade error
Comment 13 Mike Foley 2011-12-13 11:47:19 EST
Created attachment 546286 [details]
log of upgrade error
Comment 14 Mike Foley 2011-12-13 14:23:39 EST
*** Bug 753866 has been marked as a duplicate of this bug. ***
Comment 15 Jay Shaughnessy 2012-01-04 14:27:26 EST
master commit 04000903b57864003ee41a86e013ddcc39ec4789

    Fix query syntax for Oracle compatibility


Test Notes:
This was an oracle issue. Please re-test - the upgrade issues are mainly
drift related.  Having drift data (some definitions with snapshots) in
the db is needed.