Function and view to retrieve WAL receiver status

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Function and view to retrieve WAL receiver status
Date: 2015-12-14 05:56:30
Message-ID: CAB7nPqQXTmJMU=NNO_MusJGUaBWaKvZO+XUPWG9arWPx3NXvEA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Currently there is no equivalent of pg_stat_get_wal_senders for the
WAL receiver on a node, and it seems that it would be useful to have
an SQL representation of what is in shared memory should a WAL
receiver be active without going through the ps display for example.
So, any opinion about having in core a function called
pg_stat_get_wal_receiver that returns a single tuple that translates
the data WalRcvData?
We could bundle on top of it a system view, say called
pg_stat_wal_receiver, with this layer:
View "public.pg_stat_wal_receiver"
Column|Type|Modifiers
pid|integer|
status|text|
receive_start_lsn|pg_lsn|
receive_start_tli|integer|
received_up_to_lsn|pg_lsn|
received_tli|integer|
latest_chunk_start_lsn|pg_lsn|
last_msg_send_time|timestamp with time zone|
last_msg_receipt_time|timestamp with time zone|
latest_end_lsn|pg_lsn|
latest_end_time|timestamp with time zone|
slot_name|text|

If the node has no WAL receiver active, a tuple with NULL values is
returned instead.
Thoughts?
--
Michael

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-12-14 06:06:18 Re: [sqlsmith] Failed to generate plan on lateral subqueries
Previous Message Michael Paquier 2015-12-14 05:13:02 Re: Making tab-complete.c easier to maintain