Add support for syncfs() in frontend support functions.
Nathan Bossart <nathan@postgresql.org>
Add support for syncfs() in frontend support functions. This commit adds support for using syncfs() in fsync_pgdata() and fsync_dir_recurse() (which have been renamed to sync_pgdata() and sync_dir_recurse()). Like recovery_init_sync_method, sync_pgdata() calls syncfs() for the data directory, each tablespace, and pg_wal (if it is a symlink). For now, all of the frontend utilities that use these support functions are hard-coded to use fsync(), but a follow-up commit will allow specifying syncfs(). Co-authored-by: Justin Pryzby Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/20210930004340.GM831%40telsasoft.com
Files
| Path | Change | +/− |
|---|---|---|
| src/bin/initdb/initdb.c | modified | +4 −3 |
| src/bin/pg_basebackup/pg_basebackup.c | modified | +3 −2 |
| src/bin/pg_checksums/pg_checksums.c | modified | +2 −1 |
| src/bin/pg_dump/pg_backup_archiver.c | modified | +9 −5 |
| src/bin/pg_dump/pg_backup_archiver.h | modified | +1 −0 |
| src/bin/pg_dump/pg_backup_directory.c | modified | +1 −1 |
| src/bin/pg_dump/pg_backup.h | modified | +3 −1 |
| src/bin/pg_dump/pg_dump.c | modified | +2 −1 |
| src/bin/pg_rewind/file_ops.c | modified | +4 −4 |
| src/bin/pg_rewind/pg_rewind.c | modified | +1 −0 |
| src/bin/pg_rewind/pg_rewind.h | modified | +2 −0 |
| src/common/file_utils.c | modified | +155 −36 |
| src/include/common/file_utils.h | modified | +3 −2 |
Discussion
- should frontend tools use syncfs() ? 50 messages · 2021-09-30 → 2023-10-13