From: | Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Enhance pg_stat_wal_receiver view to display connected host |
Date: | 2018-01-03 01:25:15 |
Message-ID: | CAJrrPGdDLg1PecWmjpcANMeR32tZ5KZQXbeLF9g4F_xssa+qHA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Dec 22, 2017 at 4:55 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
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.
> + <row>
> + <entry><structfield>primary_hostname</structfield></entry>
> + <entry><type>text</type></entry>
> + <entry>Host name of the primary connected by this WAL
> receiver</entry>
> + </row>
> + <row>
> + <entry><structfield>primary_hostaddr</structfield></entry>
> + <entry><type>text</type></entry>
> + <entry>Host address of the primary connected by this WAL
> receiver</entry>
> + </row>
> + <row>
> + <entry><structfield>primary_port</structfield></entry>
> + <entry><type>integer</type></entry>
> + <entry>port number of the primary connected by this WAL
> receiver</entry>
> + </row>
> A WAL receiver could be connected to a standby as well with cascading
> replication, so "primary" does not sound like a term adapted to me.
> Why not just saying "XXX of the PostgreSQL instance this WAL receiver is
> connected to"? Similarly the field names don't seem adapted to me. Would
> "remote" be more adapted? Other ideas are of course welcome.
>
changed the description and field names also to remote instead of primary.
> + char host[NAMEDATALEN];
> + char hostaddr[NAMEDATALEN];
> Those two should use NI_MAXHOST as maximum length. getaddrinfo() relies on
> that.
>
Corrected.
> + retval = PQconnectedhostinfo(conn->streamConn, PQ_HOST_ADDRESS);
> + if (retval)
> + *hostaddr = pstrdup(retval);
> Yes, going through PQconnectedhostinfo() is a good idea at the end of
> the day, as well as keeping one API with libpqrcv_get_conninfo().
>
Changed as one API call.
update patch attached.
Regards,
Hari Babu
Fujitsu Australia
Attachment | Content-Type | Size |
---|---|---|
pg_stat_wal_receiver-to-display-connected-host_v2.patch | application/octet-stream | 13.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2018-01-03 01:29:15 | Re: Ensuring hash tuples are properly maxaligned |
Previous Message | Tom Lane | 2018-01-03 01:20:19 | Re: Ensuring hash tuples are properly maxaligned |