Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 09a3b19

Browse filesBrowse 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 8a07e5b commit 09a3b19
Copy full SHA for 09a3b19

File tree

Expand file treeCollapse file tree

3 files changed

+12
-3
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+12
-3
lines changed

‎doc/src/sgml/config.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/config.sgml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,8 +2471,8 @@ include_dir 'conf.d'
24712471
The <literal>open_</>* options also use <literal>O_DIRECT</> if available.
24722472
Not all of these choices are available on all platforms.
24732473
The default is the first method in the above list that is supported
2474-
by the platform, except that <literal>fdatasync</> is the default on
2475-
Linux. The default is not necessarily ideal; it might be
2474+
by the platform, except that <literal>fdatasync</literal> is the default on
2475+
Linux and FreeBSD. The default is not necessarily ideal; it might be
24762476
necessary to change this setting or other aspects of your system
24772477
configuration in order to create a crash-safe configuration or
24782478
achieve optimal performance.

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

Copy file name to clipboardExpand all lines: src/backend/utils/misc/postgresql.conf.sample
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
#wal_sync_method = fsync # the default is the first option
186186
# supported by the operating system:
187187
# open_datasync
188-
# fdatasync (default on Linux)
188+
# fdatasync (default on Linux and FreeBSD)
189189
# fsync
190190
# fsync_writethrough
191191
# open_sync

‎src/include/port/freebsd.h

Copy file name to clipboard
+9Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.