Commit 6b347118 authored by Bruce Momjian's avatar Bruce Momjian

Allocate 16mb file for testing.

parent 9e231bab
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#endif #endif
#endif #endif
#define WAL_FILE_SIZE (16 * 1024 * 1024)
void die(char *str); void die(char *str);
void print_elapse(struct timeval start_t, struct timeval elapse_t); void print_elapse(struct timeval start_t, struct timeval elapse_t);
...@@ -40,7 +42,7 @@ main(int argc, char *argv[]) ...@@ -40,7 +42,7 @@ main(int argc, char *argv[])
int tmpfile, int tmpfile,
i, i,
loops=1000; loops=1000;
char *strout = (char *) malloc(65536); char *strout = (char *) malloc(WAL_FILE_SIZE);
char *filename = FSYNC_FILENAME; char *filename = FSYNC_FILENAME;
if (argc > 2 && strcmp(argv[1],"-f") == 0) if (argc > 2 && strcmp(argv[1],"-f") == 0)
...@@ -53,12 +55,12 @@ main(int argc, char *argv[]) ...@@ -53,12 +55,12 @@ main(int argc, char *argv[])
if (argc > 1) if (argc > 1)
loops = atoi(argv[1]); loops = atoi(argv[1]);
for (i = 0; i < 65536; 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(FSYNC_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, 65536); write(tmpfile, strout, WAL_FILE_SIZE);
fsync(tmpfile); /* fsync so later fsync's don't have to do fsync(tmpfile); /* fsync so later fsync's don't have to do
* it */ * it */
close(tmpfile); close(tmpfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment