Skip to content

Commit

Permalink
Merge pull request ManageIQ#16889 from yrudman/rescue-attempt-to-get-…
Browse files Browse the repository at this point in the history
…backlog-for-replication

Rescue attempt to get backlog for remote db in PglogicalSubscription#backlog
  • Loading branch information
carbonin authored Jan 25, 2018
2 parents 9f87340 + a9e8ee8 commit 0e76e34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/pglogical_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def validate(new_connection_params = {})

def backlog
connection.xlog_location_diff(remote_node_lsn, remote_replication_lsn)
rescue PG::Error => e
_log.error(e.message)
nil
end

# translate the output from the pglogical stored proc to our object columns
Expand Down
6 changes: 6 additions & 0 deletions spec/models/pglogical_subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,5 +423,11 @@

expect(described_class.first.backlog).to eq(12_120)
end

it "returns nill if error raised inside" do
expect(MiqRegionRemote).to receive(:with_remote_connection).and_raise(PG::Error)

expect(described_class.first.backlog).to be nil
end
end
end

0 comments on commit 0e76e34

Please sign in to comment.