mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +03:00
Remove O_FSYNC and associated macros.
O_FSYNC was a pre-POSIX way of spelling O_SYNC, supported since commit
9d645fd84c
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
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user