Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
46117e4f
Commit
46117e4f
authored
Nov 16, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Have test_fsync honor -f filename argument.
parent
698ee9c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
src/tools/fsync/test_fsync.c
src/tools/fsync/test_fsync.c
+17
-17
No files found.
src/tools/fsync/test_fsync.c
View file @
46117e4f
...
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
...
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
for
(
i
=
0
;
i
<
WAL_FILE_SIZE
;
i
++
)
for
(
i
=
0
;
i
<
WAL_FILE_SIZE
;
i
++
)
strout
[
i
]
=
'a'
;
strout
[
i
]
=
'a'
;
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
|
O_CREAT
,
S_IRUSR
|
S_IWUSR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_CREAT
,
S_IRUSR
|
S_IWUSR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
write
(
tmpfile
,
strout
,
WAL_FILE_SIZE
);
write
(
tmpfile
,
strout
,
WAL_FILE_SIZE
);
fsync
(
tmpfile
);
/* fsync so later fsync's don't have to do it */
fsync
(
tmpfile
);
/* fsync so later fsync's don't have to do it */
...
@@ -69,7 +69,7 @@ main(int argc, char *argv[])
...
@@ -69,7 +69,7 @@ main(int argc, char *argv[])
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
{
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
write
(
tmpfile
,
strout
,
8192
);
write
(
tmpfile
,
strout
,
8192
);
close
(
tmpfile
);
close
(
tmpfile
);
...
@@ -86,12 +86,12 @@ main(int argc, char *argv[])
...
@@ -86,12 +86,12 @@ main(int argc, char *argv[])
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
{
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
write
(
tmpfile
,
strout
,
8192
);
write
(
tmpfile
,
strout
,
8192
);
fsync
(
tmpfile
);
fsync
(
tmpfile
);
close
(
tmpfile
);
close
(
tmpfile
);
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
/* do nothing but the open/close the tests are consistent. */
/* do nothing but the open/close the tests are consistent. */
close
(
tmpfile
);
close
(
tmpfile
);
...
@@ -105,12 +105,12 @@ main(int argc, char *argv[])
...
@@ -105,12 +105,12 @@ main(int argc, char *argv[])
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
{
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
write
(
tmpfile
,
strout
,
8192
);
write
(
tmpfile
,
strout
,
8192
);
close
(
tmpfile
);
close
(
tmpfile
);
/* reopen file */
/* reopen file */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
fsync
(
tmpfile
);
fsync
(
tmpfile
);
close
(
tmpfile
);
close
(
tmpfile
);
...
@@ -123,7 +123,7 @@ main(int argc, char *argv[])
...
@@ -123,7 +123,7 @@ main(int argc, char *argv[])
printf
(
"
\n
Compare one o_sync write to two:
\n
"
);
printf
(
"
\n
Compare one o_sync write to two:
\n
"
);
/* 16k o_sync write */
/* 16k o_sync write */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -135,7 +135,7 @@ main(int argc, char *argv[])
...
@@ -135,7 +135,7 @@ main(int argc, char *argv[])
printf
(
"
\n
"
);
printf
(
"
\n
"
);
/* 2*8k o_sync writes */
/* 2*8k o_sync writes */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -153,7 +153,7 @@ main(int argc, char *argv[])
...
@@ -153,7 +153,7 @@ main(int argc, char *argv[])
#ifdef OPEN_DATASYNC_FLAG
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
/* open_dsync, write */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
|
O_DSYNC
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_DSYNC
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -168,7 +168,7 @@ main(int argc, char *argv[])
...
@@ -168,7 +168,7 @@ main(int argc, char *argv[])
printf
(
"
\n
"
);
printf
(
"
\n
"
);
/* open_fsync, write */
/* open_fsync, write */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -181,7 +181,7 @@ main(int argc, char *argv[])
...
@@ -181,7 +181,7 @@ main(int argc, char *argv[])
#ifdef HAVE_FDATASYNC
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
/* write, fdatasync */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -199,7 +199,7 @@ main(int argc, char *argv[])
...
@@ -199,7 +199,7 @@ main(int argc, char *argv[])
printf
(
"
\n
"
);
printf
(
"
\n
"
);
/* write, fsync, close */
/* write, fsync, close */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -217,7 +217,7 @@ main(int argc, char *argv[])
...
@@ -217,7 +217,7 @@ main(int argc, char *argv[])
#ifdef OPEN_DATASYNC_FLAG
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
/* open_dsync, write */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
|
O_DSYNC
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_DSYNC
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -235,7 +235,7 @@ main(int argc, char *argv[])
...
@@ -235,7 +235,7 @@ main(int argc, char *argv[])
printf
(
"
\n
"
);
printf
(
"
\n
"
);
/* open_fsync, write */
/* open_fsync, write */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -251,7 +251,7 @@ main(int argc, char *argv[])
...
@@ -251,7 +251,7 @@ main(int argc, char *argv[])
#ifdef HAVE_FDATASYNC
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
/* write, fdatasync */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -270,7 +270,7 @@ main(int argc, char *argv[])
...
@@ -270,7 +270,7 @@ main(int argc, char *argv[])
printf
(
"
\n
"
);
printf
(
"
\n
"
);
/* write, fsync, close */
/* write, fsync, close */
if
((
tmpfile
=
open
(
FSYNC_FILENAME
,
O_RDWR
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"can't open /var/tmp/test_fsync.out"
);
die
(
"can't open /var/tmp/test_fsync.out"
);
gettimeofday
(
&
start_t
,
NULL
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
for
(
i
=
0
;
i
<
loops
;
i
++
)
...
@@ -285,7 +285,7 @@ main(int argc, char *argv[])
...
@@ -285,7 +285,7 @@ main(int argc, char *argv[])
print_elapse
(
start_t
,
elapse_t
);
print_elapse
(
start_t
,
elapse_t
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
unlink
(
FSYNC_FILENAME
);
unlink
(
filename
);
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment