Thread: Fast Shutdown (SIGINT) results in a CHECKPOINT...

Fast Shutdown (SIGINT) results in a CHECKPOINT...

From
Sean Chittenden
Date:
For a while now I've known that sending a SIGINT can trigger a CHECKPOINT, but I don't know if this is intentional or a
bug.Logs from today: 

> 2013-03-20_18:21:43.27642 LOG:  received fast shutdown request
> 2013-03-20_18:21:43.27645 LOG:  aborting any active transactions
> 2013-03-20_18:21:43.27647 FATAL:  terminating connection due to administrator command
> 2013-03-20_18:22:14.25763 FATAL:  the database system is shutting down
> 2013-03-20_18:22:14.26401 LOG:  checkpoint starting: shutdown immediate
> 2013-03-20_18:25:36.98507 LOG:  checkpoint complete: wrote 6403 buffers (2.3%); 0 transaction log file(s) added, 0
removed,5 recycled; write=41.450 s, sync=156.157 s, total=202.943 s; sync files=50, longest=29.057 s, average=3.123 s 

> 2013-03-20_18:25:37.65570 FATAL:  the database system is shutting down
> 2013-03-20_18:25:37.71735 LOG:  online backup mode canceled

And I believe this is where the db restarted:

> 2013-03-20_18:25:37.71739 DETAIL:  "backup_label" was renamed to "backup_label.old".
> 2013-03-20_18:25:45.39001 LOG:  loaded library "auto_explain"
> 2013-03-20_18:25:45.39647 LOG:  loaded library "pg_stat_statements"
> 2013-03-20_18:26:04.67932 LOG:  could not create socket for statistics collector: Protocol not supported
> 2013-03-20_18:26:04.67939 LOG:  trying another address for the statistics collector
> 2013-03-20_18:26:05.01894 LOG:  connection received: host=172.16.4.24 port=55414
> 2013-03-20_18:26:05.01903 FATAL:  the database system is starting up
> 2013-03-20_18:26:05.41153 LOG:  autovacuum launcher started
> 2013-03-20_18:26:05.41160 LOG:  database system is ready to accept connections


Just shy of 5 minutes to do a fast shutdown/restart.

What I'm trying to determine is whether or not it's a bug for postmaster to CHECKPOINT during a fast shutdown or a
documentationbug that a fast shutdown may cause a CHECKPOINT, which will delay the database being restarted. 

I've run in to this before and in some scripts I run a CHECKPOINT before sending a SIGINT, which reduces the size of
theCHECKPOINT, but doesn't necessarily eliminate it all of the time. In fact, I'm not sure it happens 100% of the time
either,but today I was bit by this shutdown/startup delay and thought I'd inquire or submit a small doc patch. Thanks
inadvance. -sc 



--
Sean Chittenden
sean@chittenden.org



Re: Fast Shutdown (SIGINT) results in a CHECKPOINT...

From
Peter Eisentraut
Date:
On 3/20/13 4:28 PM, Sean Chittenden wrote:
> For a while now I've known that sending a SIGINT can trigger a CHECKPOINT, but I don't know if this is intentional or
abug. 

It's intentional.  If you don't want that, use SIGQUIT.  That's how they
are different.

Of course, when using SIGQUIT, you will have to spend the time you saved
on the checkpoint for the recovery at startup.  So you have to put in
the time either way.

It is not unheard of that a shutdown can take minutes.  That's why the
-t option was added to pg_ctl some time ago.