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

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(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-10-26 11:12:20
Message-ID: CAFjFpRcFbJY0poq1WL=+FHurw0PnXLSBpqoLqHpAHWESnHTWUw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 28, 2016 at 8:37 AM, Tsunakawa, Takayuki
<tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com> 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.
>

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-10-26 11:15:15 Re: [PATCH] pgpassfile connection option
Previous Message Amit Kapila 2016-10-26 11:04:00 Re: 9.6, background worker processes, and PL/Java