Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9dd79339
Commit
9dd79339
authored
14 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Use XLOG_BLCKSZ in pg_test_fsync, rather than our own define, but verify
it is 8k as expected.
parent
9fc01922
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/pg_test_fsync/pg_test_fsync.c
+13
-11
13 additions, 11 deletions
contrib/pg_test_fsync/pg_test_fsync.c
with
13 additions
and
11 deletions
contrib/pg_test_fsync/pg_test_fsync.c
+
13
−
11
View file @
9dd79339
...
@@ -20,7 +20,9 @@
...
@@ -20,7 +20,9 @@
*/
*/
#define FSYNC_FILENAME "./pg_test_fsync.out"
#define FSYNC_FILENAME "./pg_test_fsync.out"
#define WRITE_SIZE (8 * 1024)
/* 8k */
#if XLOG_BLCKSZ != 8 * 1024
/* 8k */
#error Unknown block size for test.
#endif
#define LABEL_FORMAT " %-32s"
#define LABEL_FORMAT " %-32s"
#define NA_FORMAT LABEL_FORMAT "%18s"
#define NA_FORMAT LABEL_FORMAT "%18s"
...
@@ -198,7 +200,7 @@ test_sync(int writes_per_op)
...
@@ -198,7 +200,7 @@ test_sync(int writes_per_op)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
die
(
"seek failed"
);
...
@@ -225,7 +227,7 @@ test_sync(int writes_per_op)
...
@@ -225,7 +227,7 @@ test_sync(int writes_per_op)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
die
(
"seek failed"
);
...
@@ -253,7 +255,7 @@ test_sync(int writes_per_op)
...
@@ -253,7 +255,7 @@ test_sync(int writes_per_op)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
fdatasync
(
tmpfile
);
fdatasync
(
tmpfile
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
...
@@ -278,7 +280,7 @@ test_sync(int writes_per_op)
...
@@ -278,7 +280,7 @@ test_sync(int writes_per_op)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
if
(
fsync
(
tmpfile
)
!=
0
)
if
(
fsync
(
tmpfile
)
!=
0
)
die
(
"fsync failed"
);
die
(
"fsync failed"
);
...
@@ -302,7 +304,7 @@ test_sync(int writes_per_op)
...
@@ -302,7 +304,7 @@ test_sync(int writes_per_op)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
if
(
pg_fsync_writethrough
(
tmpfile
)
!=
0
)
if
(
pg_fsync_writethrough
(
tmpfile
)
!=
0
)
die
(
"fsync failed"
);
die
(
"fsync failed"
);
...
@@ -333,7 +335,7 @@ test_sync(int writes_per_op)
...
@@ -333,7 +335,7 @@ test_sync(int writes_per_op)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
die
(
"seek failed"
);
...
@@ -360,7 +362,7 @@ test_sync(int writes_per_op)
...
@@ -360,7 +362,7 @@ test_sync(int writes_per_op)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
for
(
ops
=
0
;
ops
<
ops_per_test
;
ops
++
)
{
{
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
for
(
writes
=
0
;
writes
<
writes_per_op
;
writes
++
)
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
if
(
lseek
(
tmpfile
,
0
,
SEEK_SET
)
==
-
1
)
die
(
"seek failed"
);
die
(
"seek failed"
);
...
@@ -465,7 +467,7 @@ test_file_descriptor_sync(void)
...
@@ -465,7 +467,7 @@ test_file_descriptor_sync(void)
{
{
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
die
(
"could not open output file"
);
die
(
"could not open output file"
);
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
if
(
fsync
(
tmpfile
)
!=
0
)
if
(
fsync
(
tmpfile
)
!=
0
)
die
(
"fsync failed"
);
die
(
"fsync failed"
);
...
@@ -494,7 +496,7 @@ test_file_descriptor_sync(void)
...
@@ -494,7 +496,7 @@ test_file_descriptor_sync(void)
{
{
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
die
(
"could not open output file"
);
die
(
"could not open output file"
);
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
close
(
tmpfile
);
close
(
tmpfile
);
/* reopen file */
/* reopen file */
...
@@ -526,7 +528,7 @@ test_non_sync(void)
...
@@ -526,7 +528,7 @@ test_non_sync(void)
{
{
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
if
((
tmpfile
=
open
(
filename
,
O_RDWR
,
0
))
==
-
1
)
die
(
"could not open output file"
);
die
(
"could not open output file"
);
if
(
write
(
tmpfile
,
buf
,
WRITE_SIZE
)
!=
WRITE_SIZE
)
if
(
write
(
tmpfile
,
buf
,
XLOG_BLCKSZ
)
!=
XLOG_BLCKSZ
)
die
(
"write failed"
);
die
(
"write failed"
);
close
(
tmpfile
);
close
(
tmpfile
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment