Re: Enhance pg_stat_wal_receiver view to display connected host

Поиск
Список
Период
Сортировка
От Haribabu Kommi
Тема Re: Enhance pg_stat_wal_receiver view to display connected host
Дата
Msg-id CAJrrPGeE0zY03phJByjofnN2TV9bSf4fu2yy=v4DyWw_Dj=bRQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Enhance pg_stat_wal_receiver view to display connected host  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Enhance pg_stat_wal_receiver view to display connected host
Список pgsql-hackers


On Fri, Jan 5, 2018 at 12:05 AM, Michael Paquier <michael.paquier@gmail.com> wrote:
On Thu, Jan 04, 2018 at 08:54:37AM -0300, Alvaro Herrera wrote:
> I think more attention should be given to the libpq side of this patch;
> maybe have a 0001 with only the new libpq function, to easily verify
> that it does all it needs to do.  It needs docs for the new function in
> libpq.sgml; also I wonder if checking conn->status before reporting
> values is necessary; finally, has the application any good way to check
> that the values can be safely read after calling the new function?

Or instead of reinventing again the wheel, why not removing
remote_hostaddr, and fetch the wanted values from PQhost() and PQport()
after making sure that the connection status is good? There is no need
for a new API this way. And as bonus points, we can also rely on
defaults.

PQhost() doesn't provide the proper details even if we remove the 
remote_hostaddr. For example with the following conninfo,

host=host1,host2 hostaddr=127.0.0.1,127.0.0.1 port=5434,5432

The connection type for both address of the above conninfo is
CHT_HOST_ADDRESS. so the PQhost() returns the conn->pghost
value i.e "host1,host2". That returned value doesn't give the clarity to
which host it is exactly connected. Because of this reason only, I came
up with a new function.

How about changing the PQhost() function behavior? Instead of checking
the connection type, checking whether there exists any host name or not?
And also not returning "default host" details, because for the conninfo
without any host details, the return value must be NULL. But this change
may break the backward compatibility of the function.

or

write two new functions PQconnhost() and PQconnhostaddr() to return the
connected host and hostaddr and reuse the PQport() function.

Regards,
Hari Babu
Fujitsu Australia

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [JDBC] [HACKERS] Channel binding support for SCRAM-SHA-256
Следующее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] path toward faster partition pruning