diff options
author | Thomas Munro <tmunro@postgresql.org> | 2022-07-22 12:30:37 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2022-07-22 12:41:17 +1200 |
commit | a1b56090eb54544b8ae01b95b424c254c6b71678 (patch) | |
tree | b7750840d5c64e715c2f4bedd4cc980e5d1af013 /src/include/access/xlogdefs.h | |
parent | 4f1f5a7f85cee932c417aef589b27574813a06c9 (diff) |
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/include/access/xlogdefs.h')
-rw-r--r-- | src/include/access/xlogdefs.h | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h index a47e3eeb1f5..810cd1fd86a 100644 --- a/src/include/access/xlogdefs.h +++ b/src/include/access/xlogdefs.h @@ -69,28 +69,12 @@ typedef uint16 RepOriginId; * are available on the current platform, and to choose an appropriate * default method. We assume that fsync() is always available, and that * configure determined whether fdatasync() is. + * + * Note that we define our own O_DSYNC on Windows, but not O_SYNC. */ -#if defined(O_SYNC) -#define OPEN_SYNC_FLAG O_SYNC -#elif defined(O_FSYNC) -#define OPEN_SYNC_FLAG O_FSYNC -#endif - -#if defined(O_DSYNC) -#if defined(OPEN_SYNC_FLAG) -/* O_DSYNC is distinct? */ -#if O_DSYNC != OPEN_SYNC_FLAG -#define OPEN_DATASYNC_FLAG O_DSYNC -#endif -#else /* !defined(OPEN_SYNC_FLAG) */ -/* Win32 only has O_DSYNC */ -#define OPEN_DATASYNC_FLAG O_DSYNC -#endif -#endif - #if defined(PLATFORM_DEFAULT_SYNC_METHOD) #define DEFAULT_SYNC_METHOD PLATFORM_DEFAULT_SYNC_METHOD -#elif defined(OPEN_DATASYNC_FLAG) +#elif defined(O_DSYNC) && (!defined(O_SYNC) || O_DSYNC != O_SYNC) #define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC #elif defined(HAVE_FDATASYNC) #define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC |