mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +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:
@@ -1650,6 +1650,14 @@ CheckPointTwoPhase(XLogRecPtr redo_horizon)
|
||||
}
|
||||
LWLockRelease(TwoPhaseStateLock);
|
||||
|
||||
/*
|
||||
* Flush unconditionally the parent directory to make any information
|
||||
* durable on disk. Two-phase files could have been removed and those
|
||||
* removals need to be made persistent as well as any files newly created
|
||||
* previously since the last checkpoint.
|
||||
*/
|
||||
fsync_fname(TWOPHASE_DIR, true);
|
||||
|
||||
TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE();
|
||||
|
||||
if (log_checkpoints && serialized_xacts > 0)
|
||||
|
||||
Reference in New Issue
Block a user