Re: Adding Unix domain socket path and port to pg_stat_get_wal_senders()

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: euler(at)timbira(dot)com(dot)br
Cc: michael(at)paquier(dot)xyz, ishii(at)sraoss(dot)co(dot)jp, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Adding Unix domain socket path and port to pg_stat_get_wal_senders()
Date: 2019-04-14 12:16:41
Message-ID: 20190414.211641.1894238656546034469.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> The question is: what is the problem we want to solve?

The client_hostname is useful for TCP/IP connections because it
indicates which row of the view is related to which standby server. I
would like to have the same for UNIX domain socket case as well.

> Ishii-san asked
> for a socket path. If we have already figured out the replica (via
> application_name), use the replica PID to find the socket path.

Well, I would like to avoid to use application_name if possible.

> A new
> column as suggested by Tom could show the desired info. Is it *really*
> useful? I mean, how many setups have master and replica in the same
> server?

For developing/testing purpose I often create master and some replicas
in the same server. The same technique is used in a regression test
for Pgpool-II.

> For a socket connection, directory is important and that
> information I can get from unix_socket_directories parameter (I've
> never seen a setup with multiple socket directories).

Yes, it could be a way to get the same information that
sockaddr_un.sunpath used to provide. But now I realize that it's not
what I want. What I actually wanted was, which row of the view is
related to which standby server. So what I really need is the standby
server's accepting socket path, *not* primary server's. Currently it
seems it's not possible except using the application_name
hack. Probably cleaner way would be walreciver provides socket path
information in startup packet and walsender keeps the info in shared
memory so that pg_stat_replication view can use it later on.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Darafei Komяpa Praliaskouski 2019-04-14 12:51:05 Re: Berserk Autovacuum (let's save next Mandrill)
Previous Message David Rowley 2019-04-14 11:21:15 Re: pg_dump is broken for partition tablespaces