diff --git a/lib/gems/pending/util/postgres_admin.rb b/lib/gems/pending/util/postgres_admin.rb index 95501fb15..fa97cb001 100644 --- a/lib/gems/pending/util/postgres_admin.rb +++ b/lib/gems/pending/util/postgres_admin.rb @@ -124,37 +124,6 @@ def self.restore_pg_basebackup(file) file end - def self.unload_pglogical_extension(opts) - runcmd("psql", opts, :command => <<-SQL) - SELECT - drop_subscription - FROM - pglogical.subscription subs, - LATERAL pglogical.drop_subscription(subs.sub_name) - SQL - - runcmd("psql", opts, :command => <<-SQL) - DROP EXTENSION pglogical CASCADE - SQL - - # Wait for pglogical manager connection to quiesce. Bail after 5 minutes - 60.times do - output = runcmd("psql", opts, :command => <<-SQL) - SELECT application_name - FROM pg_stat_activity - WHERE application_name LIKE 'pglogical manager%' - SQL - match = /^\((?\d+) row/.match(output) - count = match ? match[:count].to_i : 0 - break if count.zero? - - $log.info("MIQ(#{name}.#{__method__}) Waiting on #{count} pglogical connections to close...") - sleep 5 - end - rescue AwesomeSpawn::CommandResultError - $log.info("MIQ(#{name}.#{__method__}) Ignoring failure to remove pglogical before restore ...") - end - def self.backup_pg_compress(opts) opts = opts.dup @@ -180,7 +149,6 @@ def self.recreate_db(opts) end def self.restore_pg_dump(opts) - unload_pglogical_extension(opts) recreate_db(opts) runcmd("pg_restore", opts, :verbose => nil, :exit_on_error => nil, nil => opts[:local_file])