Re: [HACKERS] Patch to implement pg_current_logfile() function - Mailing list pgsql-hackers

From Karl O. Pinc
Subject Re: [HACKERS] Patch to implement pg_current_logfile() function
Date
Msg-id 20170119090859.2a54d0cc@slate.meme.com
Whole thread Raw
Responses Re: [HACKERS] Patch to implement pg_current_logfile() function  (Michael Paquier <michael.paquier@gmail.com>)
Re: [HACKERS] Patch to implement pg_current_logfile() function  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Wed, 18 Jan 2017 19:27:40 -0300
Alvaro Herrera <alvherre@2ndquadrant.com> wrote:

> Karl O. Pinc wrote:
> 
> > @@ -511,10 +519,16 @@ int
> >  SysLogger_Start(void)
> >  {
> >      pid_t        sysloggerPid;
> > -    char       *filename;
> >  
> > +    /*
> > +     * Logging collector is not enabled. We don't know where
> > messages are
> > +     * logged.  Remove outdated file holding the current log
> > filenames.
> > +     */
> >      if (!Logging_collector)
> > +    {
> > +        unlink(LOG_METAINFO_DATAFILE);
> >          return 0;
> > +    }  
> 
> I thought this part was odd -- I mean, why is SysLogger_Start() being
> called if the collector is not enabled?  Turns out we do it and return
> early if not enabled.  But not in all cases -- there is one callsite
> in postmaster.c that avoids the call if the collector is disabled.
> That needs to be changed if we want this to work reliably.

Is this an argument for having the current_logfiles always exist
and be empty when there is no in-filesystem logfile?  It always felt
to me that the code would be simpler that way.

Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."                -- Robert A. Heinlein



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] [PATCH] Fix minor race in commit_ts SLRU truncation vslookups
Next
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] Patch to implement pg_current_logfile() function