Commit 64bc8727 authored by Bruce Momjian's avatar Bruce Momjian

Adjust pg_test_fsync to always do XLOG_BLCKSZ-sized writes, rather than

always 8k writes, per suggestion from Tom.  Also adjust open_sync output
layout.
parent a91c9506
...@@ -20,9 +20,7 @@ ...@@ -20,9 +20,7 @@
*/ */
#define FSYNC_FILENAME "./pg_test_fsync.out" #define FSYNC_FILENAME "./pg_test_fsync.out"
#if XLOG_BLCKSZ != 8 * 1024 /* 8k */ #define XLOG_BLCKSZ_K (XLOG_BLCKSZ / 1024)
#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"
...@@ -61,10 +59,10 @@ main(int argc, char *argv[]) ...@@ -61,10 +59,10 @@ main(int argc, char *argv[])
test_open(); test_open();
/* Test using 1 8k write */ /* Test using 1 XLOG_BLCKSZ write */
test_sync(1); test_sync(1);
/* Test using 2 8k writes */ /* Test using 2 XLOG_BLCKSZ writes */
test_sync(2); test_sync(2);
test_open_syncs(); test_open_syncs();
...@@ -177,9 +175,9 @@ test_sync(int writes_per_op) ...@@ -177,9 +175,9 @@ test_sync(int writes_per_op)
bool fs_warning = false; bool fs_warning = false;
if (writes_per_op == 1) if (writes_per_op == 1)
printf("\nCompare file sync methods using one 8k write:\n"); printf("\nCompare file sync methods using one %dk write:\n", XLOG_BLCKSZ_K);
else else
printf("\nCompare file sync methods using two 8k writes:\n"); printf("\nCompare file sync methods using two %dk writes:\n", XLOG_BLCKSZ_K);
printf("(in wal_sync_method preference order, except fdatasync\n"); printf("(in wal_sync_method preference order, except fdatasync\n");
printf("is Linux's default)\n"); printf("is Linux's default)\n");
...@@ -396,11 +394,11 @@ test_open_syncs(void) ...@@ -396,11 +394,11 @@ test_open_syncs(void)
printf("(This is designed to compare the cost of writing 16k\n"); printf("(This is designed to compare the cost of writing 16k\n");
printf("in different write open_sync sizes.)\n"); printf("in different write open_sync sizes.)\n");
test_open_sync(" 1 16k open_sync write", 16); test_open_sync("16k open_sync write", 16);
test_open_sync(" 2 8k open_sync writes", 8); test_open_sync(" 8k open_sync writes", 8);
test_open_sync(" 4 4k open_sync writes", 4); test_open_sync(" 4k open_sync writes", 4);
test_open_sync(" 8 2k open_sync writes", 2); test_open_sync(" 2k open_sync writes", 2);
test_open_sync("16 1k open_sync writes", 1); test_open_sync(" 1k open_sync writes", 1);
} }
/* /*
...@@ -519,7 +517,7 @@ test_non_sync(void) ...@@ -519,7 +517,7 @@ test_non_sync(void)
/* /*
* Test a simple write without fsync * Test a simple write without fsync
*/ */
printf("\nNon-sync'ed 8k writes:\n"); printf("\nNon-sync'ed %dk writes:\n", XLOG_BLCKSZ_K);
printf(LABEL_FORMAT, "write"); printf(LABEL_FORMAT, "write");
fflush(stdout); fflush(stdout);
......
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