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>
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).
https://github.com/ManageIQ/manageiq/pull/12030
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(-)
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(-)
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(-)
5.6.z BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1391997
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(-)
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(-)
*** Bug 1406059 has been marked as a duplicate of this bug. ***