File tree Expand file tree Collapse file tree 1 file changed +7
-21
lines changed
Expand file tree Collapse file tree 1 file changed +7
-21
lines changed Original file line number Diff line number Diff line change 1414#include <time.h>
1515#include <sys/time.h>
1616#include <unistd.h>
17- #include <string.h>
1817
1918#ifdef WIN32
2019#define FSYNC_FILENAME "./test_fsync.out"
2120#else
2221#define FSYNC_FILENAME "/var/tmp/test_fsync.out"
2322#endif
2423
25- /* This logic comes from src/backend/access/transam/xlog.c where it's
26- better documented */
27- #ifdef O_DIRECT
28- #define PG_O_DIRECT O_DIRECT
29- #else
30- #define PG_O_DIRECT 0
31- #endif
32-
24+ /* O_SYNC and O_FSYNC are the same */
3325#if defined(O_SYNC )
34- #define BARE_OPEN_SYNC_FLAG O_SYNC
26+ #define OPEN_SYNC_FLAG O_SYNC
3527#elif defined(O_FSYNC )
36- #define BARE_OPEN_SYNC_FLAG O_FSYNC
37- #endif
38- #ifdef BARE_OPEN_SYNC_FLAG
39- #define OPEN_SYNC_FLAG (BARE_OPEN_SYNC_FLAG | PG_O_DIRECT)
28+ #define OPEN_SYNC_FLAG O_FSYNC
29+ #elif defined(O_DSYNC )
30+ #define OPEN_DATASYNC_FLAG O_DSYNC
4031#endif
4132
42- #if defined(O_DSYNC )
4333#if defined(OPEN_SYNC_FLAG )
44- #if O_DSYNC != BARE_OPEN_SYNC_FLAG
45- #define OPEN_DATASYNC_FLAG (O_DSYNC | PG_O_DIRECT)
46- #endif
47- #else
48- #define OPEN_DATASYNC_FLAG (O_DSYNC | PG_O_DIRECT)
34+ #if defined(O_DSYNC ) && (O_DSYNC != OPEN_SYNC_FLAG )
35+ #define OPEN_DATASYNC_FLAG O_DSYNC
4936#endif
5037#endif
5138
52-
5339#define WAL_FILE_SIZE (16 * 1024 * 1024)
5440
5541void die (char * str );
You can’t perform that action at this time.
0 commit comments