aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2022-07-22 12:30:37 +1200
committerThomas Munro <tmunro@postgresql.org>2022-07-22 12:41:17 +1200
commita1b56090eb54544b8ae01b95b424c254c6b71678 (patch)
treeb7750840d5c64e715c2f4bedd4cc980e5d1af013 /src/backend/access/transam/xlog.c
parent4f1f5a7f85cee932c417aef589b27574813a06c9 (diff)
downloadpostgresql-a1b56090eb54544b8ae01b95b424c254c6b71678.tar.gz
postgresql-a1b56090eb54544b8ae01b95b424c254c6b71678.zip
Remove O_FSYNC and associated macros.
O_FSYNC was a pre-POSIX way of spelling O_SYNC, supported since commit 9d645fd84c3 for non-conforming operating systems of the time. It's not needed on any modern system. We can just use standard O_SYNC directly if it exists (= all targeted systems except Windows), and get rid of our OPEN_SYNC_FLAG macro. Similarly for standard O_DSYNC, we can just use that directly if it exists (= all targeted systems except DragonFlyBSD), and get rid of our OPEN_DATASYNC_FLAG macro. We still avoid choosing open_datasync as a default value for wal_sync_method if O_DSYNC has the same value as O_SYNC (= only OpenBSD), so there is no change in default behavior. Discussion: https://postgr.es/m/CA%2BhUKGJE7y92NY7FG2ftUbZUaqohBU65_Ys_7xF5mUHo4wirTQ%40mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 9854b51c6af..1da3b8eb2ea 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -171,10 +171,10 @@ const struct config_enum_entry sync_method_options[] = {
#ifdef HAVE_FDATASYNC
{"fdatasync", SYNC_METHOD_FDATASYNC, false},
#endif
-#ifdef OPEN_SYNC_FLAG
+#ifdef O_SYNC
{"open_sync", SYNC_METHOD_OPEN, false},
#endif
-#ifdef OPEN_DATASYNC_FLAG
+#ifdef O_DSYNC
{"open_datasync", SYNC_METHOD_OPEN_DSYNC, false},
#endif
{NULL, 0, false}
@@ -7894,10 +7894,10 @@ get_sync_bit(int method)
/*
* Optimize writes by bypassing kernel cache with O_DIRECT when using
- * O_SYNC/O_FSYNC and O_DSYNC. But only if archiving and streaming are
- * disabled, otherwise the archive command or walsender process will read
- * the WAL soon after writing it, which is guaranteed to cause a physical
- * read if we bypassed the kernel cache. We also skip the
+ * O_SYNC and O_DSYNC. But only if archiving and streaming are disabled,
+ * otherwise the archive command or walsender process will read the WAL
+ * soon after writing it, which is guaranteed to cause a physical read if
+ * we bypassed the kernel cache. We also skip the
* posix_fadvise(POSIX_FADV_DONTNEED) call in XLogFileClose() for the same
* reason.
*
@@ -7921,13 +7921,13 @@ get_sync_bit(int method)
case SYNC_METHOD_FSYNC_WRITETHROUGH:
case SYNC_METHOD_FDATASYNC:
return 0;
-#ifdef OPEN_SYNC_FLAG
+#ifdef O_SYNC
case SYNC_METHOD_OPEN:
- return OPEN_SYNC_FLAG | o_direct_flag;
+ return O_SYNC | o_direct_flag;
#endif
-#ifdef OPEN_DATASYNC_FLAG
+#ifdef O_DSYNC
case SYNC_METHOD_OPEN_DSYNC:
- return OPEN_DATASYNC_FLAG | o_direct_flag;
+ return O_DSYNC | o_direct_flag;
#endif
default:
/* can't happen (unless we are out of sync with option array) */