Cyril VELTER <cyril.velter@libertysurf.fr> writes:
> pg_ctl output when no shm segments left

> pg_ctl: It seems another postmaster is running.  Trying to start postmaster 
> anyway.
> pg_ctl: cannot start postmaster  <-------- not true !!!
> Examine the log output.
> DEBUG:  database system was interrupted at 2001-03-18 12:01:57 CET
> DEBUG:  CheckPoint record at (0, 20204684)
> DEBUG:  Redo record at (0, 20204684); Undo record at (0, 0); Shutdown TRUE
> DEBUG:  NextTransactionId: 5384; NextOid: 153313
> DEBUG:  database system was not properly shut down; automatic recovery in 
> progress...
> DEBUG:  ReadRecord: record with zero len at (0, 20204748)
> DEBUG:  redo is not required
> DEBUG:  database system is in production state   

Looking at the pg_ctl script, it seems this must be coming from

    eval '$po_path' '$POSTOPTS' $logopt '&'

    if [ -f $PIDFILE ];then
	if [ "`sed -n 1p $PIDFILE`" = "$pid" ];then
	    echo "$CMDNAME: cannot start postmaster" 1>&2
	    echo "Examine the log output." 1>&2
	    exit 1
        fi
    fi

which is clearly not giving the postmaster enough time to remove or
rewrite the pidfile.  Shouldn't we put a "sleep 1" in there before
the "if"?

			regards, tom lane

Sun, 18 Mar 2001 12:11:54 -0500
Tom Lane <tgl@sss.pgh.pa.us>
pg_ctl problem (was Re: BeOS Patch)
At a minimum, you should do a test, and if it does not yet exist, do a
sleep, then the test again.

> Cyril VELTER <cyril.velter@libertysurf.fr> writes:
> > pg_ctl output when no shm segments left
> 
> > pg_ctl: It seems another postmaster is running.  Trying to start postmaster 
> > anyway.
> > pg_ctl: cannot start postmaster  <-------- not true !!!
> > Examine the log output.
> > DEBUG:  database system was interrupted at 2001-03-18 12:01:57 CET
> > DEBUG:  CheckPoint record at (0, 20204684)
> > DEBUG:  Redo record at (0, 20204684); Undo record at (0, 0); Shutdown TRUE
> > DEBUG:  NextTransactionId: 5384; NextOid: 153313
> > DEBUG:  database system was not properly shut down; automatic recovery in 
> > progress...
> > DEBUG:  ReadRecord: record with zero len at (0, 20204748)
> > DEBUG:  redo is not required
> > DEBUG:  database system is in production state   
> 
> Looking at the pg_ctl script, it seems this must be coming from
> 
>     eval '$po_path' '$POSTOPTS' $logopt '&'
> 
>     if [ -f $PIDFILE ];then
> 	if [ "`sed -n 1p $PIDFILE`" = "$pid" ];then
> 	    echo "$CMDNAME: cannot start postmaster" 1>&2
> 	    echo "Examine the log output." 1>&2
> 	    exit 1
>         fi
>     fi
> 
> which is clearly not giving the postmaster enough time to remove or
> rewrite the pidfile.  Shouldn't we put a "sleep 1" in there before
> the "if"?
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Sun, 18 Mar 2001 12:29:21 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: pg_ctl problem (was Re: BeOS Patch)
Tom Lane writes:

>     eval '$po_path' '$POSTOPTS' $logopt '&'
>
>     if [ -f $PIDFILE ];then
> 	if [ "`sed -n 1p $PIDFILE`" = "$pid" ];then
> 	    echo "$CMDNAME: cannot start postmaster" 1>&2
> 	    echo "Examine the log output." 1>&2
> 	    exit 1
>         fi
>     fi
>
> which is clearly not giving the postmaster enough time to remove or
> rewrite the pidfile.  Shouldn't we put a "sleep 1" in there before
> the "if"?

This is probably the best we can do.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Sun, 18 Mar 2001 20:22:31 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: pg_ctl problem (was Re: BeOS Patch)
Peter Eisentraut <peter_e@gmx.net> writes:
>> which is clearly not giving the postmaster enough time to remove or
>> rewrite the pidfile.  Shouldn't we put a "sleep 1" in there before
>> the "if"?

> This is probably the best we can do.

Actually, the whole thing should only happen if we found a pre-existing
PIDFILE anyway.  Will fix.

			regards, tom lane

Sun, 18 Mar 2001 14:39:13 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_ctl problem (was Re: BeOS Patch) 