Skip to content

Commit 1120c61

Browse files
committed
Revert out:
Update fsync test to match new O_DIRECT behavior. Greg Smith
1 parent 3455b0a commit 1120c61

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

src/tools/fsync/test_fsync.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,28 @@
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

5541
void die(char *str);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy