diff options
| author | Bruce Momjian <bruce@momjian.us> | 2006-11-23 16:41:11 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2006-11-23 16:41:11 +0000 |
| commit | 3455b0a5d57b8139b82b3e0f1cf4f7893173995d (patch) | |
| tree | 7e1dd1e03139f65503af94b104604666883c31c5 /src | |
| parent | eb1fbbe5c46970c78ef0a6e6a63b7e45606383a9 (diff) | |
| download | postgresql-3455b0a5d57b8139b82b3e0f1cf4f7893173995d.tar.gz | |
Update fsync test to match new O_DIRECT behavior.
Greg Smith
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/fsync/test_fsync.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/tools/fsync/test_fsync.c b/src/tools/fsync/test_fsync.c index 32d3aff003..c313021155 100644 --- a/src/tools/fsync/test_fsync.c +++ b/src/tools/fsync/test_fsync.c @@ -14,6 +14,7 @@ #include <time.h> #include <sys/time.h> #include <unistd.h> +#include <string.h> #ifdef WIN32 #define FSYNC_FILENAME "./test_fsync.out" @@ -21,21 +22,34 @@ #define FSYNC_FILENAME "/var/tmp/test_fsync.out" #endif -/* O_SYNC and O_FSYNC are the same */ +/* This logic comes from src/backend/access/transam/xlog.c where it's + better documented */ +#ifdef O_DIRECT +#define PG_O_DIRECT O_DIRECT +#else +#define PG_O_DIRECT 0 +#endif + #if defined(O_SYNC) -#define OPEN_SYNC_FLAG O_SYNC +#define BARE_OPEN_SYNC_FLAG O_SYNC #elif defined(O_FSYNC) -#define OPEN_SYNC_FLAG O_FSYNC -#elif defined(O_DSYNC) -#define OPEN_DATASYNC_FLAG O_DSYNC +#define BARE_OPEN_SYNC_FLAG O_FSYNC +#endif +#ifdef BARE_OPEN_SYNC_FLAG +#define OPEN_SYNC_FLAG (BARE_OPEN_SYNC_FLAG | PG_O_DIRECT) #endif +#if defined(O_DSYNC) #if defined(OPEN_SYNC_FLAG) -#if defined(O_DSYNC) && (O_DSYNC != OPEN_SYNC_FLAG) -#define OPEN_DATASYNC_FLAG O_DSYNC +#if O_DSYNC != BARE_OPEN_SYNC_FLAG +#define OPEN_DATASYNC_FLAG (O_DSYNC | PG_O_DIRECT) +#endif +#else +#define OPEN_DATASYNC_FLAG (O_DSYNC | PG_O_DIRECT) #endif #endif + #define WAL_FILE_SIZE (16 * 1024 * 1024) void die(char *str); |
