Re: PG service restart failure (start getting ahead of stop?)

From: Brent Wood <b(dot)wood(at)niwa(dot)co(dot)nz>
To: George Pavlov <gpavlov(at)mynewplace(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: PG service restart failure (start getting ahead of stop?)
Date: 2007-04-24 01:06:07
Message-ID: 462D57FF.3090402@niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

George Pavlov wrote:
> We have a nightly restart of one PG database. Today it failed and I
> can't seem to understand why and how to prevent this in the future (nor
> can I reproduce the problem).
>
>
If you get the PID of the psql server process then invoke a STOP, then
have a loop waiting for that PID to disappear, then run your START, it
may do what you want. Or someone may have a more elegant solution :-)

Brent Wood

> We have a line in a shell script that calls "/etc/init.d/postgresql
> restart". In the shell script's log from this invocation I have:
>
> Stopping postgresql service: [FAILED]
> Starting postgresql service: [ OK ]
>
> The outcome of this was that the service was not running (despite the "[
> OK ]" on the second line). The query log from that run ends with:
>
> 2007-04-23 03:03:59 PDT [23265] LOG: received fast shutdown request
> 2007-04-23 03:03:59 PDT [23265] LOG: aborting any active transactions
> 2007-04-23 03:03:59 PDT [26749] FATAL: terminating connection due to
> administrator command
> <... snipped more lines like the one above ...>
> 2007-04-23 03:03:59 PDT [24090] LOG: could not send data to client:
> Broken pipe
> 2007-04-23 03:03:59 PDT [26700] FATAL: terminating connection due to
> administrator command
> <... snipped more lines like the one above ...>
> 2007-04-23 03:04:13 PDT [26820] FATAL: the database system is
> shutting down
> <... snipped more lines like the one above ...>
> 2007-04-23 03:06:10 PDT [23269] LOG: shutting down
> 2007-04-23 03:06:10 PDT [23269] LOG: database system is shut down
> 2007-04-23 03:06:13 PDT [23267] LOG: logger shutting down
> <end of log>
>
> So it looks like the STOPPING of the service actually succeeded, albeit
> it took a while (more than the usual sessions open?). The STARTING is
> the one that actually failed (is that because the STOP was still in
> process?). The question is why -- in a RESTART situation
> wouldn't/shouldn't the START part wait for the STOP part to complete
> (regardless of how long it takes)?
>
> Also what can we do to avoid this in the future? We can issue a separate
> STOP and then a START X minutes later, but how long an X? It would seem
> that a RESTART is really what I want...
>
> TIA,
>
> George
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brent Wood 2007-04-24 01:08:23 Re: where clause help
Previous Message Ketema 2007-04-24 01:00:06 Re: where clause help