Re: [RFC] Should we fix postmaster to avoid slow shutdown? - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: [RFC] Should we fix postmaster to avoid slow shutdown?
Date
Msg-id CAFjFpRcFbJY0poq1WL=+FHurw0PnXLSBpqoLqHpAHWESnHTWUw@mail.gmail.com
Whole thread Raw
In response to Re: [RFC] Should we fix postmaster to avoid slow shutdown?  ("Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>)
Responses Re: [RFC] Should we fix postmaster to avoid slow shutdown?  (Robert Haas <robertmhaas@gmail.com>)
Re: [RFC] Should we fix postmaster to avoid slow shutdown?  ("Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>)
List pgsql-hackers
On Wed, Sep 28, 2016 at 8:37 AM, Tsunakawa, Takayuki
<tsunakawa.takay@jp.fujitsu.com> wrote:
>> From: pgsql-hackers-owner@postgresql.org
>> [mailto:pgsql-hackers-owner@postgresql.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
uses9.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.
>

I agree with the first point.

The patch applies and compiles clean. make check-world is clean.

In pgstat_quickdie(), I think a call to sigaddset(&BlockSig, SIGQUIT) is
missing before PG_SETMASK(). Although there are some SIGQUIT handlers which do
not have that call. But I guess, it will be safer to have it.

Also, many other SIGQUIT handlers like bgworker_quickdie() call on_exit_reset()
followed by exit(2) instead of just exit(1) in pgstat_quickdie(). Why is this
difference?

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: 9.6, background worker processes, and PL/Java
Next
From: Fabien COELHO
Date:
Subject: Re: [PATCH] pgpassfile connection option