Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3455b0a

Browse files
committed
Update fsync test to match new O_DIRECT behavior.
Greg Smith
1 parenteb1fbbe commit3455b0a

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

‎src/tools/fsync/test_fsync.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,42 @@
1414
#include<time.h>
1515
#include<sys/time.h>
1616
#include<unistd.h>
17+
#include<string.h>
1718

1819
#ifdefWIN32
1920
#defineFSYNC_FILENAME"./test_fsync.out"
2021
#else
2122
#defineFSYNC_FILENAME"/var/tmp/test_fsync.out"
2223
#endif
2324

24-
/* O_SYNC and O_FSYNC are the same */
25+
/* This logic comes from src/backend/access/transam/xlog.c where it's
26+
better documented */
27+
#ifdefO_DIRECT
28+
#definePG_O_DIRECT O_DIRECT
29+
#else
30+
#definePG_O_DIRECT 0
31+
#endif
32+
2533
#if defined(O_SYNC)
26-
#defineOPEN_SYNC_FLAGO_SYNC
34+
#defineBARE_OPEN_SYNC_FLAGO_SYNC
2735
#elif defined(O_FSYNC)
28-
#defineOPEN_SYNC_FLAGO_FSYNC
29-
#elif defined(O_DSYNC)
30-
#defineOPEN_DATASYNC_FLAGO_DSYNC
36+
#defineBARE_OPEN_SYNC_FLAG O_FSYNC
37+
#endif
38+
#ifdefBARE_OPEN_SYNC_FLAG
39+
#defineOPEN_SYNC_FLAG (BARE_OPEN_SYNC_FLAG | PG_O_DIRECT)
3140
#endif
3241

42+
#if defined(O_DSYNC)
3343
#if defined(OPEN_SYNC_FLAG)
34-
#if defined(O_DSYNC)&& (O_DSYNC!=OPEN_SYNC_FLAG)
35-
#defineOPEN_DATASYNC_FLAGO_DSYNC
44+
#ifO_DSYNC!=BARE_OPEN_SYNC_FLAG
45+
#defineOPEN_DATASYNC_FLAG (O_DSYNC | PG_O_DIRECT)
46+
#endif
47+
#else
48+
#defineOPEN_DATASYNC_FLAG (O_DSYNC | PG_O_DIRECT)
3649
#endif
3750
#endif
3851

52+
3953
#defineWAL_FILE_SIZE(16 * 1024 * 1024)
4054

4155
voiddie(char*str);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp