mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -577,6 +577,13 @@ ShutdownCLOG(void)
|
||||
/* Flush dirty CLOG pages to disk */
|
||||
TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(false);
|
||||
SimpleLruFlush(ClogCtl, false);
|
||||
|
||||
/*
|
||||
* fsync pg_xact to ensure that any files flushed previously are durably
|
||||
* on disk.
|
||||
*/
|
||||
fsync_fname("pg_xact", true);
|
||||
|
||||
TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(false);
|
||||
}
|
||||
|
||||
@ -589,6 +596,13 @@ CheckPointCLOG(void)
|
||||
/* Flush dirty CLOG pages to disk */
|
||||
TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(true);
|
||||
SimpleLruFlush(ClogCtl, true);
|
||||
|
||||
/*
|
||||
* fsync pg_xact to ensure that any files flushed previously are durably
|
||||
* on disk.
|
||||
*/
|
||||
fsync_fname("pg_xact", true);
|
||||
|
||||
TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user