Adding Unix domain socket path and port to pg_stat_get_wal_senders()

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Adding Unix domain socket path and port to pg_stat_get_wal_senders()
Date: 2019-04-12 00:16:27
Message-ID: 20190412.091627.1006481076692343036.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Currently pg_stat_replication view does not tell useful information
regarding client connections if UNIX domain sockets are used for
communication between sender and receiver. So it is not possible to
tell which row corresponds to which standby server.

test=# select client_addr, client_hostname, client_port,sync_state client_port from pg_stat_replication;
client_addr | client_hostname | client_port | client_port
-------------+-----------------+-------------+-------------
| | -1 | async
| | -1 | async
(2 rows)

This is due to that pg_stat_replication is created from
pg_stat_get_activity view. pg_stat_get_activity view calls
pg_stat_get_activity() which returns always NULL, NULL, -1 for
client_add, client_hostname and client_port.

else if (beentry->st_clientaddr.addr.ss_family == AF_UNIX)
{
/*
* Unix sockets always reports NULL for host and -1 for
* port, so it's possible to tell the difference to
* connections we have no permissions to view, or with
* errors.
*/

Changing this behavior would affect existing pg_stat_get_activity view
users and I hesitate to do so. I wonder if we could add receiver's
UNIX domain socket path to from pg_stat_get_wal_senders() (which is
called from pg_stat_replication view) so that the poor UNIX domain
socket users could make their own view or access
pg_stat_get_wal_senders() to get the UNIX domain socket path.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2019-04-12 00:59:33 Re: finding changed blocks using WAL scanning
Previous Message Daniel Gustafsson 2019-04-11 21:08:07 Re: Enable data checksums by default