Re: Log notice that checkpoint is to be written on shutdown

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Michael Banck <michael(dot)banck(at)credativ(dot)de>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Log notice that checkpoint is to be written on shutdown
Date: 2014-10-09 17:12:52
Message-ID: CAMkU=1z=5qG6swPSL2zubfjArJO3Z1WeWK04i5E9swupQP0U1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 8, 2014 at 10:52 AM, Michael Banck <michael(dot)banck(at)credativ(dot)de>
wrote:

> 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?
>

It could just print out a reminder that a checkpoint will occur, depending
on what mode of shutdown was requested. I don't think this reminder has be
validated by the server itself, the intention should be enough.

Most people who don't know that a clean shutdown inherently involves a
checkpoint probably don't monitor the server log closely, either. Of
course if they use packager scripts to do the shutdown and those scripts
don't pass along the message, I guess that still doesn't help.

Cheers,

Jeff

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2014-10-09 17:17:41 Expose options to explain? (track_io_timing)
Previous Message Joshua D. Drake 2014-10-09 15:44:06 Re: Corporate and Individual Contributor License Agreements (CLAs)