Re: pgsql: pg_ctl: Detect current standby state from pg_control - Mailing list pgsql-committers

From Michael Paquier
Subject Re: pgsql: pg_ctl: Detect current standby state from pg_control
Date
Msg-id CAB7nPqQfktJ5rd1g+hXhKaSaUQk3y=4eydNLG2sOw8chAvY2cw@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: pg_ctl: Detect current standby state from pg_control  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: pg_ctl: Detect current standby state from pg_control  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
On Mon, Sep 26, 2016 at 12:54 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> pg_ctl: Detect current standby state from pg_control
>
> Coverity thinks that this patch introduced a bunch of
> null-pointer-dereference hazards, and AFAICS it is right.
> The change in get_controlfile()'s API is completely broken
> and needs to be undone.

So you'd rather have a sleep(1) and complicate this code to replace it
with a WaitLatch() when the code is used by the backend? I don't agree
with that as the new API is cleaner as presented, though I agree that
it is a change that caller does not get any result in case of a CRC
mismatch, but who's going to use results that cannot be trusted
anyway? It seems to me that the correct fix here is that
pg_controldata.c should just exit like in the attached patch. Somewhat
I missed that during my lookup of c1dc51d4.

If we would still want callers of get_controlfile() to be allowed to
read untrustworthy results, we could just add a boolean status flag..
--
Michael

Attachment

pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Refer to OS X as "macOS", except for the port name which is stil
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Refactor script execution state machine in pgbench.