On Tue, Jan 30, 2007 at 11:45:24AM -0500, Tom Lane wrote:
> Magnus Hagander <[EMAIL PROTECTED]> writes:
> > But I guess maybe the added check has to be not just (!syslogger_started)
> > but (!syslogger_started && is_postmaster)?
> 
> That would at least get you out of the problem of having to transmit the
> syslogger_started flag to the backends...

Here's a patch that does just this.

//Magnus

Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.516
diff -c -r1.516 postmaster.c
*** src/backend/postmaster/postmaster.c 29 Jan 2007 20:17:40 -0000      1.516
--- src/backend/postmaster/postmaster.c 30 Jan 2007 23:10:20 -0000
***************
*** 202,209 ****
                        BgWriterPID = 0,
                        AutoVacPID = 0,
                        PgArchPID = 0,
!                       PgStatPID = 0,
!                       SysLoggerPID = 0;
  
  /* Startup/shutdown state */
  #define                       NoShutdown              0
--- 202,209 ----
                        BgWriterPID = 0,
                        AutoVacPID = 0,
                        PgArchPID = 0,
!                       PgStatPID = 0;
! pid_t                 SysLoggerPID = 0; /* Needs to be accessed from elog.c */
  
  /* Startup/shutdown state */
  #define                       NoShutdown              0
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: c:/prog/cvsrepo/pgsql/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.181
diff -c -r1.181 elog.c
*** src/backend/utils/error/elog.c      20 Jan 2007 21:40:25 -0000      1.181
--- src/backend/utils/error/elog.c      30 Jan 2007 23:16:44 -0000
***************
*** 76,81 ****
--- 76,83 ----
  
  sigjmp_buf *PG_exception_stack = NULL;
  
+ extern pid_t SysLoggerPID;
+ 
  /* GUC parameters */
  PGErrorVerbosity Log_error_verbosity = PGERROR_VERBOSE;
  char     *Log_line_prefix = NULL;             /* format for extra log line 
info */
***************
*** 1693,1701 ****
                 * anything going there and write it to the eventlog instead.
                 *
                 * If stderr redirection is active, it's ok to write to stderr 
because
!                * that's really a pipe to the syslogger process.
                 */
!               if ((!Redirect_stderr || am_syslogger) && pgwin32_is_service())
                        write_eventlog(edata->elevel, buf.data);
                else
  #endif
--- 1695,1704 ----
                 * anything going there and write it to the eventlog instead.
                 *
                 * If stderr redirection is active, it's ok to write to stderr 
because
!                * that's really a pipe to the syslogger process. Unless we're 
in the
!                  * postmaster, and the syslogger process isn't started yet.
                 */
!               if ((!Redirect_stderr || am_syslogger || (!IsUnderPostmaster && 
SysLoggerPID==0)) && pgwin32_is_service())
                        write_eventlog(edata->elevel, buf.data);
                else
  #endif
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to