mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +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:
@@ -28,6 +28,7 @@
|
||||
#include "compress_io.h"
|
||||
#include "parallel.h"
|
||||
#include "pg_backup_utils.h"
|
||||
#include "common/file_utils.h"
|
||||
|
||||
/*--------
|
||||
* Routines in the format interface
|
||||
@@ -721,6 +722,10 @@ _CloseArchive(ArchiveHandle *AH)
|
||||
if (fclose(AH->FH) != 0)
|
||||
exit_horribly(modulename, "could not close archive file: %s\n", strerror(errno));
|
||||
|
||||
/* Sync the output file if one is defined */
|
||||
if (AH->dosync && AH->mode == archModeWrite && AH->fSpec)
|
||||
(void) fsync_fname(AH->fSpec, false, progname);
|
||||
|
||||
AH->FH = NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user