Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec67869

Browse files
committed
Make write of pgstats file durable at shutdown
This switches the pgstats write code to use durable_rename() rather thanrename(). This ensures that the stats file's data is durable when thestatistics are written, which is something only happening at shutdownnow with the checkpointer doing the job.This could cause the statistics to be lost even after PostgreSQL is shutdown, should a host failure happen, for example.Suggested-by: Konstantin KnizhnikReviewed-by: Bertrand DrouvotDiscussion:https://postgr.es/m/ZpDQTZ0cAz0WEbh7@paquier.xyz
1 parent4b74ebf commitec67869

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

‎src/backend/utils/activity/pgstat.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,12 +1478,9 @@ pgstat_write_statsfile(void)
14781478
tmpfile)));
14791479
unlink(tmpfile);
14801480
}
1481-
elseif (rename(tmpfile,statfile)<0)
1481+
elseif (durable_rename(tmpfile,statfile,LOG)<0)
14821482
{
1483-
ereport(LOG,
1484-
(errcode_for_file_access(),
1485-
errmsg("could not rename temporary statistics file \"%s\" to \"%s\": %m",
1486-
tmpfile,statfile)));
1483+
/* durable_rename already emitted log message */
14871484
unlink(tmpfile);
14881485
}
14891486
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp