Re: Log notice that checkpoint is to be written on shutdown - Mailing list pgsql-hackers

From Michael Banck
Subject Re: Log notice that checkpoint is to be written on shutdown
Date
Msg-id 1412790725.5382.21.camel@hartree.muc.credativ.lan
Whole thread Raw
In response to Re: Log notice that checkpoint is to be written on shutdown  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: Log notice that checkpoint is to be written on shutdown
Re: Log notice that checkpoint is to be written on shutdown
List pgsql-hackers
Hi,

Am Samstag, den 04.10.2014, 15:05 -0500 schrieb Jim Nasby:
> On 10/4/14, 1:21 PM, Jeff Janes wrote:
> > On Thu, Oct 2, 2014 at 6:21 AM, Michael Banck wrote:
> >     we have seen repeatedly that users can be confused about why PostgreSQL
> >     is not shutting down even though they requested it. Usually, this is
> >     because `log_checkpoints' is not enabled and the final checkpoint is
> >     being written, delaying shutdown. As no message besides "shutting down"
> >     is written to the server log in this case, we even had users believing
> >     the server was hanging and pondering killing it manually.
> >
> >
>> Wouldn't a better place to write this message be the terminal from 
>> which "pg_ctl stop" was invoked, rather than the server log file?

Looking at it from a DBA perspective, this would indeed be better, yes.

However, I see a few issues with that:

1. If you are using an init script (or another wrapper around pg_ctl),
you don't get any of its output it seems.

2. Having taken a quick look at pg_ctl, it seems to just kill the
postmaster on shutdown and wait for its PID file to disappear.  I don't
see how it should figure out that PostgreSQL is waiting for a checkpoint
to be finished?

> Or do both. I suspect elog( INFO, ... ) might do that.

That would imply that pg_ctl receives and writes out log messages
directed at clients, which I don't think is true?  Even if it was,
client_min_messages does not include an INFO level, and LOG is not being
logged to clients by default. So the first common level above the
default of both client_min_messages and log_min_messages would be
WARNING, which seems excessive to me.

As I said, I only took a quick look at pg_ctl though, so I might well be
missing something.


Michael

-- 
Michael Banck
Projektleiter / Berater
Tel.: +49 (2161) 4643-171
Fax:  +49 (2161) 4643-100
Email: michael.banck@credativ.de

credativ GmbH, HRB Mönchengladbach 12080
USt-ID-Nummer: DE204566209
Hohenzollernstr. 133, 41061 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer




pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Context lenses to set/get values in json values.
Next
From: Robert Haas
Date:
Subject: Re: Deferring some AtStart* allocations?