Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a27f3a7

Browse files
committed
Default to wal_sync_method=fdatasync on FreeBSD.
FreeBSD 13 gained O_DSYNC, which would normally cause wal_sync_method to choose open_datasync as its default value. That may not be a good choice for all systems, and performs worse than fdatasync in some scenarios. Let's preserve the existing default behavior for now. Like commit 576477e, which did the same for Linux, back-patch to all supported releases. Discussion: https://postgr.es/m/CA%2BhUKGLsAMXBQrCxCXoW-JsUYmdOL8ALYvaX%3DCrHqWxm-nWbGA%40mail.gmail.com
1 parent 840eda0 commit a27f3a7

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

doc/src/sgml/config.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2772,7 +2772,7 @@ include_dir 'conf.d'
27722772
Not all of these choices are available on all platforms.
27732773
The default is the first method in the above list that is supported
27742774
by the platform, except that <literal>fdatasync</literal> is the default on
2775-
Linux. The default is not necessarily ideal; it might be
2775+
Linux and FreeBSD. The default is not necessarily ideal; it might be
27762776
necessary to change this setting or other aspects of your system
27772777
configuration in order to create a crash-safe configuration or
27782778
achieve optimal performance.

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
#wal_sync_method = fsync # the default is the first option
201201
# supported by the operating system:
202202
# open_datasync
203-
# fdatasync (default on Linux)
203+
# fdatasync (default on Linux and FreeBSD)
204204
# fsync
205205
# fsync_writethrough
206206
# open_sync

src/include/port/freebsd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
/* src/include/port/freebsd.h */
2+
3+
/*
4+
* Set the default wal_sync_method to fdatasync. xlogdefs.h's normal rules
5+
* would prefer open_datasync on FreeBSD 13+, but that is not a good choice on
6+
* many systems.
7+
*/
8+
#ifdef HAVE_FDATASYNC
9+
#define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
10+
#endif

0 commit comments

Comments
 (0)