Re: primary_conninfo missing from pg_stat_wal_receiver

Michael Paquier <michael.paquier@gmail.com>

From: Michael Paquier <michael.paquier@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, Stephen Frost <sfrost@snowman.net>, Tom Lane <tgl@sss.pgh.pa.us>, Tatsuo Ishii <ishii@postgresql.org>, Vik Fearing <vik@2ndquadrant.fr>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2016-06-30T12:41:19Z
Lists: pgsql-hackers
On Thu, Jun 30, 2016 at 9:35 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
> On Thu, Jun 30, 2016 at 9:30 PM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> On Thu, Jun 30, 2016 at 8:59 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
>>> (2)
>>> +retry:
>>> +    SpinLockAcquire(&walrcv->mutex);
>>> +    if (!walrcv->ready_to_display)
>>> +    {
>>> +        SpinLockRelease(&walrcv->mutex);
>>> +        CHECK_FOR_INTERRUPTS();
>>> +        pg_usleep(1000);
>>> +        goto retry;
>>> +    }
>>> +    SpinLockRelease(&walrcv->mutex);
>>>
>>> ISTM that we will never be able to get out of this loop if walreceiver
>>> fails to connect to the master (e.g., password is wrong) after we enter
>>> this loop.
>>
>> Wouldn't it be cleaner to just return an error here instead of retrying?
>
> I prefer to return NULL. Now NULL is returned when walreceiver's pid is 0.
> We can just change this logic so that NULL is returned pid is 0 OR the
> flag is false.

OK, yes. That's indeed better this way. Need a patch?
-- 
Michael


Commits

  1. Add conninfo to pg_stat_wal_receiver

  2. Only show pg_stat_replication details to superusers