Skip to content

Commit

Permalink
Use the new config handler for logical replication failover
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonin committed May 7, 2019
1 parent ea9167b commit 81ddc80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ gem "log_decorator", "~>0.1", :require => false
gem "manageiq-api-client", "~>0.3.3", :require => false
gem "manageiq-messaging", "~>0.1.4", :require => false
gem "manageiq-password", "~>0.3", :require => false
gem "manageiq-postgres_ha_admin", "~>3.0", :require => false
gem "manageiq-postgres_ha_admin", "~>3.0", :git => "https://github.com/carbonin/manageiq-postgres_ha_admin.git", :branch => "add_logical_replication_config_handler", :require => false
gem "memoist", "~>0.15.0", :require => false
gem "mime-types", "~>3.0", :path => File.expand_path("mime-types-redirector", __dir__)
gem "more_core_extensions", "~>3.7"
Expand Down
8 changes: 4 additions & 4 deletions lib/evm_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def self.run_failover_monitor(monitor = nil)
monitor ||= ManageIQ::PostgresHaAdmin::FailoverMonitor.new(Rails.root.join("config", "ha_admin.yml"))

configure_rails_handler(monitor)
configure_pglogical_handlers(monitor)
configure_logical_replication_handlers(monitor)

_log.info("Starting database failover monitor")
monitor.monitor_loop
Expand Down Expand Up @@ -177,12 +177,12 @@ def self.configure_rails_handler(monitor)
end
private_class_method :configure_rails_handler

def self.configure_pglogical_handlers(monitor)
def self.configure_logical_replication_handlers(monitor)
return unless MiqServer.my_server.has_active_role?("database_operations")

local_db_conninfo = ActiveRecord::Base.connection.raw_connection.conninfo_hash.delete_blanks
PglogicalSubscription.all.each do |s|
handler = ManageIQ::PostgresHaAdmin::PglogicalConfigHandler.new(:subscription => s.id, :conn_info => local_db_conninfo)
handler = ManageIQ::PostgresHaAdmin::LogicalReplicationConfigHandler.new(:subscription => s.id, :conn_info => local_db_conninfo)
_log.info("Configuring database failover for replication subscription #{s.id} ")

handler.after_failover do |new_conn_info|
Expand All @@ -193,5 +193,5 @@ def self.configure_pglogical_handlers(monitor)
monitor.add_handler(handler)
end
end
private_class_method :configure_pglogical_handlers
private_class_method :configure_logical_replication_handlers
end

0 comments on commit 81ddc80

Please sign in to comment.