mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Fsync directory after creating or unlinking file.
If file was created/deleted just before powerloss it's possible that file system will miss that. To prevent it, call fsync() where creating/ unlinkg file is critical. Author: Michael Paquier Reviewed-by: Ashutosh Bapat, Takayuki Tsunakawa, me
This commit is contained in:
@ -746,6 +746,12 @@ ShutdownCommitTs(void)
|
||||
{
|
||||
/* Flush dirty CommitTs pages to disk */
|
||||
SimpleLruFlush(CommitTsCtl, false);
|
||||
|
||||
/*
|
||||
* fsync pg_commit_ts to ensure that any files flushed previously are durably
|
||||
* on disk.
|
||||
*/
|
||||
fsync_fname("pg_commit_ts", true);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -756,6 +762,12 @@ CheckPointCommitTs(void)
|
||||
{
|
||||
/* Flush dirty CommitTs pages to disk */
|
||||
SimpleLruFlush(CommitTsCtl, true);
|
||||
|
||||
/*
|
||||
* fsync pg_commit_ts to ensure that any files flushed previously are durably
|
||||
* on disk.
|
||||
*/
|
||||
fsync_fname("pg_commit_ts", true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user