Bug 753866

Summary: DB Upgrade needs more work for existing drift records
Product: [Other] RHQ Project Reporter: Jay Shaughnessy <jshaughn>
Component: DatabaseAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED DUPLICATE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2CC: hrupp
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: Environment:
Last Closed: 2011-12-13 19:23:39 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:    
Bug Blocks: 751778, 753872, 760116    

Description Jay Shaughnessy 2011-11-14 17:45:19 UTC
This is a continuation of work started for bug 751778.

For RHQ 4.2 to 4.3 db upgrades, when drift related tables have been
populated, there are some java-based upgrade steps that need to be
written and performed to complete the upgrade correctly. See the
TODOs in db-upgrade.xml, schema spec 1.115.

Comment 1 Jay Shaughnessy 2011-12-06 21:17:58 UTC
master commit 64c7032453ec453246ffb3a9a2bcb664903be88e

This is to support RHQ 4.1 and 4.2 drift upgrades to 4.3.  It adds
two Java upgrade tasks and puts them into the existing 2.115 step. (JON
note, JON3.0 already places the db at 2.116 and the previous
version of 2.115 was already sufficient for JON3.0 purposes. We *do not*
want these new changes applied to JON3.0 upgrades and so I did not
create a new schema task for this, on purpose.)

Test Notes:
I've tested this in a simulated way on Postgres but not in a real
upgrade.  I have not tested this at all on Oracle although it is
written to handle Oracle-specific  syntax where needed.

After the upgrade the Administration-> Drift Templates page should
be inspected to make sure the templates look correct.

Comment 2 Jay Shaughnessy 2011-12-06 22:09:22 UTC
moving back to ON_DEV

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, I think,
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.

This is all related to the Drift feature's required schema.

More dev testing required here before releasing to QA.

Comment 3 Jay Shaughnessy 2011-12-08 21:56:24 UTC
master commit dedfe6ad8738d1be1c5a411943e4e48d4410ffd2

More work to support 4.1 and 4.2 upgrades for drift.
- In the java template map upgrade task
  - add logic to generate the rhq_drift_def_template records
  - add logic to generate rhq_drift_set records for each initial 
    changeset
- Move some logic from 2.115 to 2.116 to make 2.115 match the
  schema produced by a 4.2 dbsetup (fresh db).  Note that prior to
  an upgrade 4.2 databases must (for now at least) be manually set
  to schema version 2.115.  They are errantly set to 2.114 in the 4.2
  release.

Test Notes
- The upgrades have not been tested on Oracle
- As mentioned above, you can not upgrade to 4.2. 4.2 requires a new db
- You can upgrade from 4.1 (or before,I suppose)
- You can upgrade from 4.2 assuming the db is set to schema version
  2.115 before the upgrade starts.  See the 4.3 release notes for
  more on what needs to be done:

http://rhq-project.org/display/RHQ/Release+Notes+4.3.0

- The upgrade issues are mainly drift related.  Having drift data
  (some definitions with snapshots) in the db is needed.

Comment 4 Mike Foley 2011-12-13 19:23:39 UTC

*** This bug has been marked as a duplicate of bug 751778 ***