aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_rewind/file_ops.c
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2023-09-06 16:27:00 -0700
committerNathan Bossart <nathan@postgresql.org>2023-09-06 16:27:00 -0700
commitcccc6cdeb32f010f1cf777a9e9a85344a4317ab8 (patch)
tree989510ddcfe04a8503da11931e5c043dee189cfc /src/bin/pg_rewind/file_ops.c
parent3ed19567198ddb34ab32be6ebdf132148287abdf (diff)
downloadpostgresql-cccc6cdeb32f010f1cf777a9e9a85344a4317ab8.tar.gz
postgresql-cccc6cdeb32f010f1cf777a9e9a85344a4317ab8.zip
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
Diffstat (limited to 'src/bin/pg_rewind/file_ops.c')
-rw-r--r--src/bin/pg_rewind/file_ops.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c
index 25996b4da47..dd226859329 100644
--- a/src/bin/pg_rewind/file_ops.c
+++ b/src/bin/pg_rewind/file_ops.c
@@ -286,9 +286,9 @@ remove_target_symlink(const char *path)
*
* We do this once, for the whole data directory, for performance reasons. At
* the end of pg_rewind's run, the kernel is likely to already have flushed
- * most dirty buffers to disk. Additionally fsync_pgdata uses a two-pass
- * approach (only initiating writeback in the first pass), which often reduces
- * the overall amount of IO noticeably.
+ * most dirty buffers to disk. Additionally sync_pgdata uses a two-pass
+ * approach when fsync is specified (only initiating writeback in the first
+ * pass), which often reduces the overall amount of IO noticeably.
*/
void
sync_target_dir(void)
@@ -296,7 +296,7 @@ sync_target_dir(void)
if (!do_sync || dry_run)
return;
- fsync_pgdata(datadir_target, PG_VERSION_NUM);
+ sync_pgdata(datadir_target, PG_VERSION_NUM, sync_method);
}