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

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Log notice that checkpoint is to be written on shutdown
Date: 2014-10-02 15:17:32
Message-ID: 1412263052328-5821417.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Banck-2 wrote
> Hi,
>
> 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.
>
> In order to alert those users that a checkpoint is being written, I
> propose to add a log message "waiting for checkpoint ..." on shutdown,
> even if log_checkpoints is disabled, as this particular checkpoint might
> be important information.
>
> I've attached a trivial patch for this, should it be added to the next
> commitfest?

Peeking at this provokes a couple of novice questions:

While apparently it is impossible to have a checkpoint to log at recovery
end the decision to use the bitwise-OR instead of the local "shutdown" bool
seemed odd at first...

LogCheckpointStart creates the log entry unconditionally - leaving the
caller responsible for evaluating log_checkpoints - while LogCheckpointEnd
has the log_checkpoints condition built into it. I mention this because by
the same argument advocating the logging of the checkpoint start we should
also log its end. In order to do that here, though, we have to change
log_checkpoints before calling LogCheckpointEnd. Now, since we going to
shutdown anyway that seems benign (and forecloses on any need to set it back
to the prior value) but its still ugly.

Just some thoughts...

The rationale makes perfect sense. +1

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Log-notice-that-checkpoint-is-to-be-written-on-shutdown-tp5821394p5821417.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-10-02 15:18:39 Re: Inefficient barriers on solaris with sun cc
Previous Message Stephen Frost 2014-10-02 15:03:36 Re: Per table autovacuum vacuum cost limit behaviour strange