Bug 1289200

Summary: Replication: host_storages table, duplicate key
Product: Red Hat CloudForms Management Engine Reporter: John Prause <jprause>
Component: ApplianceAssignee: Nick Carboni <ncarboni>
Status: CLOSED ERRATA QA Contact: Jan Krocil <jkrocil>
Severity: high Docs Contact:
Priority: high    
Version: 5.5.0CC: abellott, agrare, cpelland, dajohnso, jhardy, jkrocil, mfeifer, ncarboni, obarenbo, snansi
Target Milestone: GAKeywords: ZStream
Target Release: 5.5.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.5.2.1 Doc Type: Bug Fix
Doc Text:
Upgrading to the previous version of CloudForms Management Engine from an earlier version could result in a database replication failure with a duplicate key present error on the master appliance. This error was a result of id numbers from the incorrect region being assigned to host storage records. This bug was fixed by removing the records with the incorrect ids and resetting the replication triggers to the correct region. Database replication completes successfully in the new version of CloudForms Management Engine.
Story Points: ---
Clone Of: 1289156 Environment:
Last Closed: 2016-04-13 18:39:36 UTC Type: Bug
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: 1289156, 1301135    
Bug Blocks:    

Comment 2 CFME Bot 2015-12-11 14:43:05 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=8d95d01585bcde5f320fa6c6a5bf46cb7fbfcaf1

commit 8d95d01585bcde5f320fa6c6a5bf46cb7fbfcaf1
Author:     Nick Carboni <ncarboni>
AuthorDate: Tue Dec 8 16:06:55 2015 -0500
Commit:     Nick Carboni <ncarboni>
CommitDate: Wed Dec 9 14:39:01 2015 -0500

    Add migration to fix host_storages replication issue
    
    After we run the migration added in commit 04f2fa211b8ebeb0557ca3712af846c9b556869f
    the table host_storages will be assigned a primary key column and existing
    rows will be given a value within the current region's range.
    
    This causes an issue when run on a replication target as the id should
    match the one on the replication source region not the target one.
    
    This fix removes the entries in the host_storages table on the target
    region and resets the replication triggers on the source regions.
    
    Upstream PR: https://github.com/ManageIQ/manageiq/pull/5760
    Clean cherry-pick from upstream master
    https://bugzilla.redhat.com/show_bug.cgi?id=1289200

 ...0956_fix_host_storage_replication_on_upgrade.rb | 49 ++++++++++++++++++++++
 ...fix_host_storage_replication_on_upgrade_spec.rb | 47 +++++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 db/migrate/20151208150956_fix_host_storage_replication_on_upgrade.rb
 create mode 100644 spec/migrations/20151208150956_fix_host_storage_replication_on_upgrade_spec.rb

Comment 3 CFME Bot 2015-12-11 14:43:21 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=b91ec3af94818b1905e371327f535ae15628a42a

commit b91ec3af94818b1905e371327f535ae15628a42a
Merge: 49e4bd5 8d95d01
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Fri Dec 11 09:38:16 2015 -0500
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Fri Dec 11 09:38:16 2015 -0500

    Merge branch 'backport_host_storage_replication_fix' into '5.5.z'
    
    Add migration to fix host_storages replication issue
    
    After we run the migration added in commit 04f2fa211b8ebeb0557ca3712af846c9b556869f
    the table host_storages will be assigned a primary key column and existing
    rows will be given a value within the current region's range.
    
    This causes an issue when run on a replication target as the id should
    match the one on the replication source region not the target one.
    
    This fix removes the entries in the host_storages table on the target
    region and resets the replication triggers on the source regions.
    
    Upstream PR: https://github.com/ManageIQ/manageiq/pull/5760
    
    Clean cherry-pick from upstream master
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1289200
    
    See merge request !607

 ...0956_fix_host_storage_replication_on_upgrade.rb | 49 ++++++++++++++++++++++
 ...fix_host_storage_replication_on_upgrade_spec.rb | 47 +++++++++++++++++++++
 2 files changed, 96 insertions(+)

Comment 9 John Prause 2016-02-10 14:37:14 UTC
This was dropped from the 5.5.2 advisory.
The 5.5.2 advisory is in Rel_prep, so will move the TR to 5.5.3

Comment 16 errata-xmlrpc 2016-04-13 18:39:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:0616