Re: [RFC] Should we fix postmaster to avoid slow shutdown?

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Cc: 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 'Robert Haas' <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC] Should we fix postmaster to avoid slow shutdown?
Date: 2016-11-18 15:49:11
Message-ID: b236f233-5856-7522-9e90-32c2c788f4f0@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/27/16 11:07 PM, Tsunakawa, Takayuki wrote:
>> From: pgsql-hackers-owner(at)postgresql(dot)org
>> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Tom Lane
>> Allowing SIGQUIT to prompt fast shutdown of the stats collector seems sane,
>> though. Try to make sure it doesn't leave partly-written stats files
>> behind.
>
> The attached patch based on HEAD does this. I'd like this to be back-patched because one of our important customers uses 9.2.
>
> I didn't remove partially written stat files on SIGQUIT for the following reasons. Is this OK?
>
> 1. The recovery at the next restart will remove the stat files.
> 2. SIGQUIT processing should be as fast as possible.
> 3. If writing stats files took long due to the OS page cache flushing, removing files might be forced to wait likewise.

ISTM that this would change the "immediate shutdown" to not save stats
files anymore. So far, all the shutdown modes are equivalent in terms
of how they preserve data and system state. They differ only in when
the hard work happens. This would be a deviation from that principle.

Child processes don't distinguish between a SIGQUIT coming from a
user-initiated immediate shutdown request and a crash-induced
kill-everyone directive. So there might not be a non-ugly way to
address that.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-11-18 16:27:40 Re: [RFC] Should we fix postmaster to avoid slow shutdown?
Previous Message Albe Laurenz 2016-11-18 15:31:54 Re: Parallel execution and prepared statements