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


Reply via email to