aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/sgml/config.sgml2
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample2
-rw-r--r--src/include/port/freebsd.h9
3 files changed, 11 insertions, 2 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 5ef1c7ad3c5..4df1405d2e2 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2928,7 +2928,7 @@ include_dir 'conf.d'
Not all of these choices are available on all platforms.
The default is the first method in the above list that is supported
by the platform, except that <literal>fdatasync</literal> is the default on
- Linux. The default is not necessarily ideal; it might be
+ Linux and FreeBSD. The default is not necessarily ideal; it might be
necessary to change this setting or other aspects of your system
configuration in order to create a crash-safe configuration or
achieve optimal performance.
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index bd57e917e16..db6db376eb0 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -206,7 +206,7 @@
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
# open_datasync
- # fdatasync (default on Linux)
+ # fdatasync (default on Linux and FreeBSD)
# fsync
# fsync_writethrough
# open_sync
diff --git a/src/include/port/freebsd.h b/src/include/port/freebsd.h
index 2e36d3da4f4..2e2e749a6b6 100644
--- a/src/include/port/freebsd.h
+++ b/src/include/port/freebsd.h
@@ -1 +1,10 @@
/* src/include/port/freebsd.h */
+
+/*
+ * Set the default wal_sync_method to fdatasync. xlogdefs.h's normal rules
+ * would prefer open_datasync on FreeBSD 13+, but that is not a good choice on
+ * many systems.
+ */
+#ifdef HAVE_FDATASYNC
+#define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
+#endif