From cccc6cdeb32f010f1cf777a9e9a85344a4317ab8 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Wed, 6 Sep 2023 16:27:00 -0700 Subject: 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 --- src/include/common/file_utils.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/include/common/file_utils.h') diff --git a/src/include/common/file_utils.h b/src/include/common/file_utils.h index 7da21f15e6e..49d523e611f 100644 --- a/src/include/common/file_utils.h +++ b/src/include/common/file_utils.h @@ -34,8 +34,9 @@ struct iovec; /* avoid including port/pg_iovec.h here */ #ifdef FRONTEND extern int fsync_fname(const char *fname, bool isdir); -extern void fsync_pgdata(const char *pg_data, int serverVersion); -extern void fsync_dir_recurse(const char *dir); +extern void sync_pgdata(const char *pg_data, int serverVersion, + DataDirSyncMethod sync_method); +extern void sync_dir_recurse(const char *dir, DataDirSyncMethod sync_method); extern int durable_rename(const char *oldfile, const char *newfile); extern int fsync_parent_path(const char *fname); #endif -- cgit v1.2.3