Bug 1380475 - Enabling remote replication (pglogical) logs error
Summary: Enabling remote replication (pglogical) logs error
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.6.0
Hardware: All
OS: Linux
high
high
Target Milestone: GA
: 5.8.0
Assignee: Nick Carboni
QA Contact: Alex Newman
URL:
Whiteboard:
: 1406059 (view as bug list)
Depends On:
Blocks: 1386686 1391997
TreeView+ depends on / blocked
 
Reported: 2016-09-29 17:20 UTC by Gregg Tanzillo
Modified: 2019-12-16 06:57 UTC (History)
8 users (show)

Fixed In Version: 5.8.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1386686 (view as bug list)
Environment:
Last Closed: 2017-06-12 17:04:33 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Gregg Tanzillo 2016-09-29 17:20:08 UTC
root@vc4om1lpui01:/var/www/miq/vmdb # bin/rails c
DEPRECATION WARNING: `config.serve_static_files` is deprecated and will be removed in Rails 5.1.
Please use `config.public_file_server.enabled = false` instead.
 (called from block in <top (required)> at /var/www/miq/vmdb/config/environments/production.rb:15)
Loading production environment (Rails 5.0.0)
irb(main):001:0> MiqRegion.replication_type = :remote
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 1, connections: 1, in use: 1, waiting_in_queue: 0
PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "replication_set_table_pkey"
DETAIL:  Key (set_id, set_reloid)=(9341505, 18215) already exists.

        from /var/www/miq/vmdb/lib/extensions/ar_adapter/ar_pglogical/pglogical_raw.rb:301:in `async_exec'
        from /var/www/miq/vmdb/lib/extensions/ar_adapter/ar_pglogical/pglogical_raw.rb:301:in `typed_exec'
        from /var/www/miq/vmdb/lib/extensions/ar_adapter/ar_pglogical/pglogical_raw.rb:263:in `replication_set_add_table'
        from /var/www/miq/vmdb/lib/miq_pglogical.rb:84:in `block in refresh_excludes'
        from /var/www/miq/vmdb/lib/miq_pglogical.rb:83:in `each'
        from /var/www/miq/vmdb/lib/miq_pglogical.rb:83:in `refresh_excludes'
        from /var/www/miq/vmdb/lib/miq_pglogical.rb:72:in `create_replication_set'
        from /var/www/miq/vmdb/lib/miq_pglogical.rb:46:in `configure_provider'
        from /var/www/miq/vmdb/app/models/miq_region.rb:167:in `replication_type='
        from (irb):1
        from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/console.rb:65:in `start'
        from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/console_helper.rb:9:in `start'
        from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:78:in `console'
        from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from /opt/rh/cfme-gemset/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'irb(main):002:0>

Comment 3 Nick Carboni 2016-10-18 13:54:02 UTC
I can't seem to reproduce this, but maybe we should just catch these unique constraint errors and log them rather than failing the setup.

I'll implement that, and add it as a fix for this issue.

Also, when this happens, it seems like we treat the node as configured properly as a "remote" type. We will have to see if there is a better way to check if things have not really completed setup properly.

Maybe only treat a node as "remote" if the excludes are synced properly? Not sure that's the best way to go about it, but I'm not sure what else we could look at (right now "remote" means that we have a node record and the replication set is created https://github.com/ManageIQ/manageiq/blob/master/lib/miq_pglogical.rb#L15).

Comment 4 Nick Carboni 2016-10-18 16:48:31 UTC
https://github.com/ManageIQ/manageiq/pull/12030

Comment 5 CFME Bot 2016-10-18 18:41:20 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/a0bfa09461276762dee8f82bb73422038382fd8e

commit a0bfa09461276762dee8f82bb73422038382fd8e
Author:     Nick Carboni <ncarboni>
AuthorDate: Tue Oct 18 12:12:48 2016 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Tue Oct 18 12:12:48 2016 -0400

    Enable the pglogical extension and create the replication set in a transaction
    
    This will allow us to rollback the whole process if something
    bad happens while creating the replication set (like a unique
    constraint error).
    
    After this change we will no longer see the replication type as
    "Remote" when we fail to cleanly create the provider node.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1380475

 lib/miq_pglogical.rb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comment 6 CFME Bot 2016-10-18 18:41:25 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/fa3904240ebd99956c3baafae56b9d1927c469bb

commit fa3904240ebd99956c3baafae56b9d1927c469bb
Author:     Nick Carboni <ncarboni>
AuthorDate: Tue Oct 18 12:35:33 2016 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Tue Oct 18 12:35:33 2016 -0400

    Catch unique constraint violations when adding a table to the replication set
    
    If we try to add a table that is already present in the set, we should
    not fail the creation of the node in the region.
    
    This way, the setup can continue to add other tables that may not
    have been added before.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1380475

 lib/miq_pglogical.rb                        | 8 +++++++-
 spec/replication/util/miq_pglogical_spec.rb | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Comment 7 CFME Bot 2016-10-19 04:17:16 UTC
New commit detected on ManageIQ/manageiq/euwe:
https://github.com/ManageIQ/manageiq/commit/182e5bdaa4c872a1de5455040f1dfacd22aefa83

commit 182e5bdaa4c872a1de5455040f1dfacd22aefa83
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Tue Oct 18 14:36:33 2016 -0400
Commit:     Oleg Barenboim <chessbyte>
CommitDate: Tue Oct 18 23:15:28 2016 -0500

    Merge pull request #12030 from carbonin/fix_configure_pglogical_provider_unique_constraint
    
    Fix unique constraint failure when configuring a pglogical provider node
    (cherry picked from commit df21a70250072b10957315bb29122d885f58ad95)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1380475

 lib/miq_pglogical.rb                        |  16 +++-
 spec/replication/util/miq_pglogical_spec.rb | 116 ++++++++++++++++++----------
 2 files changed, 88 insertions(+), 44 deletions(-)

Comment 9 Satoe Imaishi 2016-11-11 15:06:14 UTC
5.6.z BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1391997

Comment 10 CFME Bot 2016-12-14 03:21:18 UTC
New commit detected on ManageIQ/manageiq/darga:
https://github.com/ManageIQ/manageiq/commit/34efdccb1d099977ec8e68aefe1619496c9616a7

commit 34efdccb1d099977ec8e68aefe1619496c9616a7
Author:     Nick Carboni <ncarboni>
AuthorDate: Tue Oct 18 12:12:48 2016 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Tue Nov 8 14:54:53 2016 -0500

    Enable the pglogical extension and create the replication set in a transaction
    
    This will allow us to rollback the whole process if something
    bad happens while creating the replication set (like a unique
    constraint error).
    
    After this change we will no longer see the replication type as
    "Remote" when we fail to cleanly create the provider node.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1380475

 lib/miq_pglogical.rb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comment 11 CFME Bot 2016-12-14 03:21:23 UTC
New commit detected on ManageIQ/manageiq/darga:
https://github.com/ManageIQ/manageiq/commit/32839dcc8ac358f30ddc3d354687efd50c70f14d

commit 32839dcc8ac358f30ddc3d354687efd50c70f14d
Author:     Nick Carboni <ncarboni>
AuthorDate: Tue Oct 18 12:35:33 2016 -0400
Commit:     Nick Carboni <ncarboni>
CommitDate: Tue Nov 8 14:55:01 2016 -0500

    Catch unique constraint violations when adding a table to the replication set
    
    If we try to add a table that is already present in the set, we should
    not fail the creation of the node in the region.
    
    This way, the setup can continue to add other tables that may not
    have been added before.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1380475

 lib/miq_pglogical.rb                        | 8 +++++++-
 spec/replication/util/miq_pglogical_spec.rb | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Comment 13 Gellert Kis 2017-01-03 13:54:25 UTC
*** Bug 1406059 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.