Thread: [HACKERS] What's with all the fflush(stderr) calls in pg_standby.c?

[HACKERS] What's with all the fflush(stderr) calls in pg_standby.c?

From
Tom Lane
Date:
This looks like cargo-cult programming to me.  stderr is almost
always line-buffered, making these fflush'es pointless.  If it's
not line-buffered, that's probably because it's going to a
noninteractive destination for which this wouldn't matter.
Moreover, none of our other programs do this.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] What's with all the fflush(stderr) calls in pg_standby.c?

From
Robert Haas
Date:
On Sun, Sep 24, 2017 at 11:51 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This looks like cargo-cult programming to me.  stderr is almost
> always line-buffered, making these fflush'es pointless.  If it's
> not line-buffered, that's probably because it's going to a
> noninteractive destination for which this wouldn't matter.
> Moreover, none of our other programs do this.

On a related note, the idea of removing pg_standby altogether has been
proposed a few times.  Apparently there are a few things that it still
does better than standby_mode, but nobody seems in a hurry to do
anything about that.  Still, I'd be against spending a lot of time
trying to improve a tool that has mostly outlived its usefulness - we
ought to be trying to enhance the in-core facilities instead.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] What's with all the fflush(stderr) calls in pg_standby.c?

From
Michael Paquier
Date:
On Mon, Sep 25, 2017 at 9:45 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On a related note, the idea of removing pg_standby altogether has been
> proposed a few times.  Apparently there are a few things that it still
> does better than standby_mode, but nobody seems in a hurry to do
> anything about that.  Still, I'd be against spending a lot of time
> trying to improve a tool that has mostly outlived its usefulness - we
> ought to be trying to enhance the in-core facilities instead.

+1.
-- 
Michael


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] What's with all the fflush(stderr) calls inpg_standby.c?

From
Andres Freund
Date:
On 2017-09-25 10:01:35 +0900, Michael Paquier wrote:
> On Mon, Sep 25, 2017 at 9:45 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> > On a related note, the idea of removing pg_standby altogether has been
> > proposed a few times.

Including recently by me http://archives.postgresql.org/message-id/20170913064824.rqflkadxwpboabgw%40alap3.anarazel.de

> > Apparently there are a few things that it still
> > does better than standby_mode, but nobody seems in a hurry to do
> > anything about that.  Still, I'd be against spending a lot of time
> > trying to improve a tool that has mostly outlived its usefulness - we
> > ought to be trying to enhance the in-core facilities instead.
> 
> +1.

It's also pretty crummy code that has no test coverage. I'd just remove
it.

- Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers