pgsql: Make write of pgstats file durable at shutdown

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make write of pgstats file durable at shutdown
Date: 2024-07-17 03:06:41
Message-ID: E1sTv05-001ybS-4N@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make write of pgstats file durable at shutdown

This switches the pgstats write code to use durable_rename() rather than
rename(). This ensures that the stats file's data is durable when the
statistics are written, which is something only happening at shutdown
now with the checkpointer doing the job.

This could cause the statistics to be lost even after PostgreSQL is shut
down, should a host failure happen, for example.

Suggested-by: Konstantin Knizhnik
Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/ZpDQTZ0cAz0WEbh7@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ec678692f6d0a8b05b86ca08e96b51e4063cba32

Modified Files
--------------
src/backend/utils/activity/pgstat.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2024-07-17 08:46:59 pgsql: SQL/JSON: Rethink c2d93c3802b
Previous Message Michael Paquier 2024-07-16 23:13:02 Re: pgsql: Adjust recently added test for pg_signal_autovacuum role