From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.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
alteredwhile 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
thosefiles 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
afraidthose ideas would only be employed in a new major release, not in released versions. I'm asking for a remedy for
auser (and potential users) who use older releases. And, I don't yet understand why patch would make the situation for
existingusers, and why stop writing files during immediate/abnormal shutdown requires other efforts.
Regards
Takayuki Tsunakawa