Robert Haas wrote:
> On Fri, Jan 20, 2017 at 2:09 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
> > Okay I just did it. At the same time the check for ferror is not
> > necessary as fgets() returns NULL on an error as well so that's dead
> > code. I have also removed the useless call to FreeFile().
>
> diff --git a/src/backend/postmaster/postmaster.c
> b/src/backend/postmaster/postmaster.c
> index 271c492..a7ebb74 100644
> --- a/src/backend/postmaster/postmaster.c
> +++ b/src/backend/postmaster/postmaster.c
> @@ -1733,7 +1733,7 @@ ServerLoop(void)
> }
>
> /* If we have lost the log collector, try to start a new one */
> - if (SysLoggerPID == 0 && Logging_collector)
> + if (SysLoggerPID == 0)
> SysLoggerPID = SysLogger_Start();
>
> /*
>
> This hunk has zero chance of being acceptable, I think. We're not
> going to start running the syslogger in even when it's not configured
> to run.
So what is going on here is that SysLogger_Start() wants to unlink the
current-logfile file if the collector is not enabled. This should
probably be split out into a separate new function, for two reasons:
first, it doesn't seem good idea to have SysLogger_Start do something
other than start the logger; and second, so that we don't have a syscall
on each ServerLoop iteration. That new function should be called from
some other place -- perhaps reaper() and just before entering
ServerLoop, so that the file is deleted if the syslogger goes away or is
not started.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services