Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-30 Thread Haribabu Kommi
On Sat, Mar 31, 2018 at 10:08 AM, Fujii Masao wrote: > On Fri, Mar 30, 2018 at 9:34 AM, Michael Paquier > wrote: > > On Fri, Mar 30, 2018 at 10:52:02AM +1100, Haribabu Kommi wrote: > >> On Fri, Mar 30, 2018 at 7:26 AM, Fujii Masao > wrote: > >>> @@ -753,4 +753,6 @@ CREATE VIEW pg_stat_wal_recei

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-30 Thread Fujii Masao
On Fri, Mar 30, 2018 at 9:34 AM, Michael Paquier wrote: > On Fri, Mar 30, 2018 at 10:52:02AM +1100, Haribabu Kommi wrote: >> On Fri, Mar 30, 2018 at 7:26 AM, Fujii Masao wrote: >>> @@ -753,4 +753,6 @@ CREATE VIEW pg_stat_wal_receiver AS >>> s.latest_end_time, >>> s.slot_

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-29 Thread Michael Paquier
On Fri, Mar 30, 2018 at 10:52:02AM +1100, Haribabu Kommi wrote: > On Fri, Mar 30, 2018 at 7:26 AM, Fujii Masao wrote: >> @@ -753,4 +753,6 @@ CREATE VIEW pg_stat_wal_receiver AS >> s.latest_end_time, >> s.slot_name, >> +s.remote_server, >> +s.remote

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-29 Thread Haribabu Kommi
On Fri, Mar 30, 2018 at 7:26 AM, Fujii Masao wrote: > On Wed, Mar 28, 2018 at 3:09 PM, Michael Paquier > wrote: > > On Wed, Mar 28, 2018 at 03:41:33PM +1100, Haribabu Kommi wrote: > >> On Wed, Mar 28, 2018 at 12:54 PM, Michael Paquier > >> wrote: > >> Updated patch attached. > > Thanks for the

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-29 Thread Fujii Masao
On Wed, Mar 28, 2018 at 3:09 PM, Michael Paquier wrote: > On Wed, Mar 28, 2018 at 03:41:33PM +1100, Haribabu Kommi wrote: >> On Wed, Mar 28, 2018 at 12:54 PM, Michael Paquier >> wrote: >> Updated patch attached. Thanks for the patch! I'd like to commit this feature for v11. @@ -753,4 +753,6 @@

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-27 Thread Michael Paquier
On Wed, Mar 28, 2018 at 03:41:33PM +1100, Haribabu Kommi wrote: > On Wed, Mar 28, 2018 at 12:54 PM, Michael Paquier > wrote: > Updated patch attached. Thanks, switched as ready for committer. -- Michael signature.asc Description: PGP signature

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-27 Thread Haribabu Kommi
On Wed, Mar 28, 2018 at 12:54 PM, Michael Paquier wrote: > On Wed, Mar 28, 2018 at 11:28:32AM +1100, Haribabu Kommi wrote: > > I updated the pg_stat_wal_receiver patch with the new PQhost() function > > behavior and updated the view with two columns, (remote_server and > > remote_port) instead of

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-27 Thread Michael Paquier
On Wed, Mar 28, 2018 at 11:28:32AM +1100, Haribabu Kommi wrote: > I updated the pg_stat_wal_receiver patch with the new PQhost() function > behavior and updated the view with two columns, (remote_server and > remote_port) instead of three as earlier. > > Updated patch attached. Thanks Hari for th

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-03-27 Thread Haribabu Kommi
On Tue, Jan 30, 2018 at 4:02 PM, Michael Paquier wrote: > On Tue, Jan 30, 2018 at 03:10:12PM +1100, Haribabu Kommi wrote: > > Ok, understood. As the libpq gives preference to hostaddr connection > > parameter than host while connecting. How about going with one column > > "remote_host" that displ

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-29 Thread Michael Paquier
On Tue, Jan 30, 2018 at 03:10:12PM +1100, Haribabu Kommi wrote: > Ok, understood. As the libpq gives preference to hostaddr connection > parameter than host while connecting. How about going with one column > "remote_host" that displays either hostaddr(if exists) or hostname. So that > one column t

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-29 Thread Haribabu Kommi
On Mon, Jan 29, 2018 at 7:06 PM, Michael Paquier wrote: > On Tue, Jan 16, 2018 at 05:56:22PM +1100, Haribabu Kommi wrote: > > Without PQhostaddr() function, for the connections where the host is not > > specified, it will be difficult to find out to remote server. > > That's true as well, but hos

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-29 Thread Michael Paquier
On Tue, Jan 16, 2018 at 05:56:22PM +1100, Haribabu Kommi wrote: > Without PQhostaddr() function, for the connections where the host is not > specified, it will be difficult to find out to remote server. That's true as well, but hostaddr should be used with host only to save IP lookups... There are

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-22 Thread Haribabu Kommi
On Tue, Jan 16, 2018 at 5:56 PM, Haribabu Kommi wrote: > > On Tue, Jan 16, 2018 at 2:55 PM, Michael Paquier < > michael.paqu...@gmail.com> wrote: > >> >> Note that I still find this API confusing, it seems to me that just >> sorting out the confusion problems with PQhost and then use it would be

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-15 Thread Haribabu Kommi
[ Including Hackers as earlier mail mistakenly removed it ] On Tue, Jan 16, 2018 at 2:55 PM, Michael Paquier wrote: > On Mon, Jan 15, 2018 at 05:51:58PM +1100, Haribabu Kommi wrote: > > Instead of effective_conninfo, I changed the column name as > > remote_serve_info and > > display only the hos

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-14 Thread Haribabu Kommi
On Mon, Jan 8, 2018 at 3:32 PM, Haribabu Kommi wrote: > > > On Fri, Jan 5, 2018 at 11:15 PM, Alvaro Herrera > wrote: > >> Haribabu Kommi wrote: >> >> > or >> > >> > write two new functions PQconnhost() and PQconnhostaddr() to return the >> > connected host and hostaddr and reuse the PQport() fun

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-12 Thread Michael Paquier
On Fri, Jan 12, 2018 at 04:32:54PM +1100, Haribabu Kommi wrote: > On Fri, Jan 12, 2018 at 4:06 PM, Michael Paquier > wrote: > > On Fri, Jan 12, 2018 at 03:55:04PM +1100, Haribabu Kommi wrote: > > > Before posting the patch, first I did the same, upon further study > > > I didn't find any scenario

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-11 Thread Haribabu Kommi
On Fri, Jan 12, 2018 at 4:06 PM, Michael Paquier wrote: > On Fri, Jan 12, 2018 at 03:55:04PM +1100, Haribabu Kommi wrote: > > Before posting the patch, first I did the same, upon further study > > I didn't find any scenario where the value is not present in > > conn->connhost[conn->whichhost].hos

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-11 Thread Michael Paquier
On Fri, Jan 12, 2018 at 03:55:04PM +1100, Haribabu Kommi wrote: > Before posting the patch, first I did the same, upon further study > I didn't find any scenario where the value is not present in > conn->connhost[conn->whichhost].host and present in conn->pghost. > > If user provides "host" as con

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-11 Thread Haribabu Kommi
On Fri, Jan 12, 2018 at 3:26 PM, Michael Paquier wrote: > On Fri, Jan 12, 2018 at 11:37:22AM +0900, Michael Paquier wrote: > > I have redone my set of previous tests and can confirm that PQhost is > > behaving as I would expect it should, and those results are the same as > > yours. > > if (c

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-11 Thread Michael Paquier
On Fri, Jan 12, 2018 at 11:37:22AM +0900, Michael Paquier wrote: > I have redone my set of previous tests and can confirm that PQhost is > behaving as I would expect it should, and those results are the same as > yours. if (conn->connhost != NULL && - conn->connhost[conn->whichhost].type

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-11 Thread Michael Paquier
On Wed, Jan 10, 2018 at 04:10:35PM +1100, Haribabu Kommi wrote: > On Tue, Jan 9, 2018 at 12:15 PM, Michael Paquier > wrote: >> Hm. Any users of psql's PROMPT would be equally confused, and this can >> actually lead to more confusion from the user prospective I think than >> just pg_stat_wal_receiv

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-09 Thread Haribabu Kommi
On Tue, Jan 9, 2018 at 12:15 PM, Michael Paquier wrote: > On Fri, Jan 05, 2018 at 09:15:36AM -0300, Alvaro Herrera wrote: > > Haribabu Kommi wrote: > > > > > And also not returning "default host" details, because for the conninfo > > > without any host details, the return value must be NULL. But

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-08 Thread Michael Paquier
On Fri, Jan 05, 2018 at 09:15:36AM -0300, Alvaro Herrera wrote: > Haribabu Kommi wrote: > > > 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 functio

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-07 Thread Haribabu Kommi
On Fri, Jan 5, 2018 at 11:15 PM, Alvaro Herrera wrote: > Haribabu Kommi wrote: > > > or > > > > write two new functions PQconnhost() and PQconnhostaddr() to return the > > connected host and hostaddr and reuse the PQport() function. > > How about using an API similar to PQconninfo, where we retur

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-05 Thread Alvaro Herrera
Haribabu Kommi wrote: > 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. I wouldn't want to have to fight that battle. > or > > write two new

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-04 Thread Haribabu Kommi
On Fri, Jan 5, 2018 at 12:05 AM, Michael Paquier 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 ne

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-04 Thread Michael Paquier
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; al

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-04 Thread Michael Paquier
On Thu, Jan 04, 2018 at 05:21:02PM +1100, Haribabu Kommi wrote: > On Thu, Jan 4, 2018 at 11:53 AM, Michael Paquier > wrote: > > > On Wed, Jan 03, 2018 at 06:48:07PM +1100, Haribabu Kommi wrote: > > > On Wed, Jan 3, 2018 at 12:25 PM, Haribabu Kommi < > > kommi.harib...@gmail.com> > > > Last patch

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-04 Thread Alvaro Herrera
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 necessar

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-03 Thread Haribabu Kommi
On Thu, Jan 4, 2018 at 11:53 AM, Michael Paquier wrote: > On Wed, Jan 03, 2018 at 06:48:07PM +1100, Haribabu Kommi wrote: > > On Wed, Jan 3, 2018 at 12:25 PM, Haribabu Kommi < > kommi.harib...@gmail.com> > > Last patch has undefined symbol, corrected patch attached. > Thanks for the review. +

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-03 Thread Michael Paquier
On Wed, Jan 03, 2018 at 06:48:07PM +1100, Haribabu Kommi wrote: > On Wed, Jan 3, 2018 at 12:25 PM, Haribabu Kommi > Last patch has undefined symbol, corrected patch attached. + memset(walrcv->host, 0, NAMEDATALEN); + if (host) + strlcpy((char *) walrcv->host, host, NAMED

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-02 Thread Haribabu Kommi
On Wed, Jan 3, 2018 at 12:25 PM, Haribabu Kommi wrote: > > > update patch attached. > Last patch has undefined symbol, corrected patch attached. Regards, Hari Babu Fujitsu Australia pg_stat_wal_receiver-to-display-connected-host_v3.patch Description: Binary data

Re: Enhance pg_stat_wal_receiver view to display connected host

2018-01-02 Thread Haribabu Kommi
On Fri, Dec 22, 2017 at 4:55 PM, Michael Paquier wrote: > On Fri, Dec 22, 2017 at 03:11:07PM +1100, Haribabu Kommi wrote: > > Updated patch attached with tests and doc changes. > > Thanks for the review. > + > + primary_hostname > + text > + Host name of the primary connected by

Re: Enhance pg_stat_wal_receiver view to display connected host

2017-12-21 Thread Michael Paquier
On Fri, Dec 22, 2017 at 03:11:07PM +1100, Haribabu Kommi wrote: > Updated patch attached with tests and doc changes. + + primary_hostname + text + Host name of the primary connected by this WAL receiver + + + primary_hostaddr + text + Host address of the primary

Re: Enhance pg_stat_wal_receiver view to display connected host

2017-12-21 Thread Haribabu Kommi
On Thu, Dec 21, 2017 at 11:12 PM, Michael Paquier wrote: > On Thu, Dec 21, 2017 at 8:16 PM, Haribabu Kommi > wrote: > > The current connected host details are already available in the PGconn > > structure, > > Exposing those details in the view will suffice this requirement. > Currently > > thes

Re: Enhance pg_stat_wal_receiver view to display connected host

2017-12-21 Thread Michael Paquier
On Thu, Dec 21, 2017 at 8:16 PM, Haribabu Kommi wrote: > The current connected host details are already available in the PGconn > structure, > Exposing those details in the view will suffice this requirement. Currently > these > members are characters pointers, I used them as it is and displayed t