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

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(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-24 05:57:16
Message-ID: 0A3221C70F24FB45833433255569204D1F65A91B@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Tom Lane
> Maybe a workable compromise would be to leave the file present, and have
> the stats collector re-write it every (say) five minutes. Then I'd be okay
> with having an immediate shutdown skip writing the file; you'd be losing
> up to five minutes' worth of activity, but not going completely nuts. So
> the stats collector's normal activities would include writing the temp file
> on-demand and the permanent file on a timed cycle.
>
> The other components of the fix (deleting on PITR rewind or stats collector
> crash) would remain the same.

The manual says:

"Also, the collector itself emits a new report at most once per PGSTAT_STAT_INTERVAL milliseconds (500 ms unless altered while building the server). So the displayed information lags behind actual activity."

Doesn't this mean that the stats collector writes files in pg_stat_tmp/ every 500ms? If true, how about just moving those files into appropriate locations during recovery, instead of removing the files?

I also find others's ideas woth considering -- WAL-logging the stats files, type-specific stats files, etc. -- but I'm afraid those ideas would only be employed in a new major release, not in released versions. I'm asking for a remedy for a user (and potential users) who use older releases. And, I don't yet understand why patch would make the situation for existing users, and why stop writing files during immediate/abnormal shutdown requires other efforts.

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2016-11-24 06:04:22 Re: Declarative partitioning - another take
Previous Message Tsunakawa, Takayuki 2016-11-24 05:41:08 Re: [RFC] Should we fix postmaster to avoid slow shutdown?