mirror of
https://github.com/postgres/postgres.git
synced 2025-08-21 10:42:50 +03:00
Sync pg_dump and pg_dumpall output
Before exiting any files are fsync'ed. A --no-sync option is also provided for a faster exit if desired. Michael Paquier. Reviewed by Albe Laurenz Discussion: https://postgr.es/m/CAB7nPqS1uZ=Ov+UruW6jr3vB-S_DLVMPc0dQpV-fTDjmm0ZQMg@mail.gmail.com
This commit is contained in:
@@ -115,6 +115,25 @@ fsync_pgdata(const char *pg_data,
|
||||
walkdir(pg_tblspc, fsync_fname, true, progname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Issue fsync recursively on the given directory and all its contents.
|
||||
*
|
||||
* This is a convenient wrapper on top of walkdir().
|
||||
*/
|
||||
void
|
||||
fsync_dir_recurse(const char *dir, const char *progname)
|
||||
{
|
||||
/*
|
||||
* If possible, hint to the kernel that we're soon going to fsync the data
|
||||
* directory and its contents.
|
||||
*/
|
||||
#ifdef PG_FLUSH_DATA_WORKS
|
||||
walkdir(dir, pre_sync_fname, false, progname);
|
||||
#endif
|
||||
|
||||
walkdir(dir, fsync_fname, false, progname);
|
||||
}
|
||||
|
||||
/*
|
||||
* walkdir: recursively walk a directory, applying the action to each
|
||||
* regular file and directory (including the named directory itself).
|
||||
|
Reference in New Issue
Block a user