1
0
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:
Andrew Dunstan
2017-03-22 10:00:30 -04:00
parent 9b013dc238
commit 96a7128b7b
12 changed files with 103 additions and 8 deletions

View File

@@ -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).