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
558c4367
Commit
558c4367
authored
Nov 16, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update error message and documentation for fsync test.
parent
46117e4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
src/tools/fsync/README
src/tools/fsync/README
+2
-1
src/tools/fsync/test_fsync.c
src/tools/fsync/test_fsync.c
+17
-17
No files found.
src/tools/fsync/README
View file @
558c4367
...
...
@@ -2,4 +2,5 @@ This program tests fsync. The tests are described as part of the program output
Usage: test_fsync [-f filename] [loops]
Loops defaults to 1000.
Loops defaults to 1000. The default output file is /var/tmp/test_fsync.out.
Consider that /tmp or /var/tmp might be memory-based file systems.
src/tools/fsync/test_fsync.c
View file @
558c4367
...
...
@@ -59,7 +59,7 @@ main(int argc, char *argv[])
strout
[
i
]
=
'a'
;
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_CREAT
,
S_IRUSR
|
S_IWUSR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
write
(
tmpfile
,
strout
,
WAL_FILE_SIZE
);
fsync
(
tmpfile
);
/* fsync so later fsync's don't have to do it */
close
(
tmpfile
);
...
...
@@ -70,7 +70,7 @@ main(int argc, char *argv[])
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
write
(
tmpfile
,
strout
,
8192
);
close
(
tmpfile
);
}
...
...
@@ -87,12 +87,12 @@ main(int argc, char *argv[])
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
write
(
tmpfile
,
strout
,
8192
);
fsync
(
tmpfile
);
close
(
tmpfile
);
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
/* do nothing but the open/close the tests are consistent. */
close
(
tmpfile
);
}
...
...
@@ -106,12 +106,12 @@ main(int argc, char *argv[])
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
write
(
tmpfile
,
strout
,
8192
);
close
(
tmpfile
);
/* reopen file */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
fsync
(
tmpfile
);
close
(
tmpfile
);
}
...
...
@@ -124,7 +124,7 @@ main(int argc, char *argv[])
/* 16k o_sync write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
write
(
tmpfile
,
strout
,
16384
);
...
...
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
/* 2*8k o_sync writes */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -154,7 +154,7 @@ main(int argc, char *argv[])
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_DSYNC
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
write
(
tmpfile
,
strout
,
8192
);
...
...
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
/* open_fsync, write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
write
(
tmpfile
,
strout
,
8192
);
...
...
@@ -182,7 +182,7 @@ main(int argc, char *argv[])
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -200,7 +200,7 @@ main(int argc, char *argv[])
/* write, fsync, close */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -218,7 +218,7 @@ main(int argc, char *argv[])
#ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
O_DSYNC
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -236,7 +236,7 @@ main(int argc, char *argv[])
/* open_fsync, write */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
|
OPEN_SYNC_FLAG
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -252,7 +252,7 @@ main(int argc, char *argv[])
#ifdef HAVE_FDATASYNC
/* write, fdatasync */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -271,7 +271,7 @@ main(int argc, char *argv[])
/* write, fsync, close */
if
((
tmpfile
=
open
(
filename
,
O_RDWR
))
==
-
1
)
die
(
"
can't open /var/tmp/test_fsync.out
"
);
die
(
"
Cannot open output file.
"
);
gettimeofday
(
&
start_t
,
NULL
);
for
(
i
=
0
;
i
<
loops
;
i
++
)
{
...
...
@@ -306,6 +306,6 @@ print_elapse(struct timeval start_t, struct timeval elapse_t)
void
die
(
char
*
str
)
{
fprintf
(
stderr
,
"%s"
,
str
);
fprintf
(
stderr
,
"%s
\n
"
,
str
);
exit
(
1
);
}
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