Add last failed connection error message to pg_stat_wal_receiver - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Add last failed connection error message to pg_stat_wal_receiver
Date
Msg-id CALj2ACWt6wkFnu7sac3pUb4WLZ3jA1m3cu7FJE3EovpGKzhwKw@mail.gmail.com
Whole thread Raw
Responses Re: Add last failed connection error message to pg_stat_wal_receiver
List pgsql-hackers
Hi,

In production environments WAL receiver connection attempts to primary
may fail for many reasons (primary down, network is broken,
authentication tokens changes, primary_conn_info modifications, socket
errors and so on.). Although we emit the error message to server logs,
isn't it useful to show the last connection error message via
pg_stat_wal_receiver or pg_stat_get_wal_receiver? This will be super
helpful in production environments to analyse what the WAL receiver
issues as accessing and sifting through server logs can be quite
cumbersome for the end users.

Thoughts?

Attached patch can only display the last_conn_error only after the WAL
receiver is up, but it will be good to let pg_stat_wal_receiver emit
last_conn_error even before that. Imagine WAL receiver is continuously
failing on the standby, if we let pg_stat_wal_receiver report
last_conn_error, all other columns will show NULL. I can change this
way, if others are okay with it.

Regards,
Bharath Rupireddy.

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Rewriting the test of pg_upgrade as a TAP test - take three - remastered set
Next
From: Etsuro Fujita
Date:
Subject: Re: postgres_fdw: commit remote (sub)transactions in parallel during pre-commit