Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 64bc872

Browse files
committed
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.
1 parent a91c950 commit 64bc872

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

contrib/pg_test_fsync/pg_test_fsync.c

+11-13
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
*/
2121
#define FSYNC_FILENAME "./pg_test_fsync.out"
2222

23-
#if XLOG_BLCKSZ != 8 * 1024 /* 8k */
24-
#error Unknown block size for test.
25-
#endif
23+
#define XLOG_BLCKSZ_K (XLOG_BLCKSZ / 1024)
2624

2725
#define LABEL_FORMAT " %-32s"
2826
#define NA_FORMAT LABEL_FORMAT "%18s"
@@ -61,10 +59,10 @@ main(int argc, char *argv[])
6159

6260
test_open();
6361

64-
/* Test using 1 8k write */
62+
/* Test using 1 XLOG_BLCKSZ write */
6563
test_sync(1);
6664

67-
/* Test using 2 8k writes */
65+
/* Test using 2 XLOG_BLCKSZ writes */
6866
test_sync(2);
6967

7068
test_open_syncs();
@@ -177,9 +175,9 @@ test_sync(int writes_per_op)
177175
bool fs_warning = false;
178176

179177
if (writes_per_op == 1)
180-
printf("\nCompare file sync methods using one 8k write:\n");
178+
printf("\nCompare file sync methods using one %dk write:\n", XLOG_BLCKSZ_K);
181179
else
182-
printf("\nCompare file sync methods using two 8k writes:\n");
180+
printf("\nCompare file sync methods using two %dk writes:\n", XLOG_BLCKSZ_K);
183181
printf("(in wal_sync_method preference order, except fdatasync\n");
184182
printf("is Linux's default)\n");
185183

@@ -396,11 +394,11 @@ test_open_syncs(void)
396394
printf("(This is designed to compare the cost of writing 16k\n");
397395
printf("in different write open_sync sizes.)\n");
398396

399-
test_open_sync(" 1 16k open_sync write", 16);
400-
test_open_sync(" 2 8k open_sync writes", 8);
401-
test_open_sync(" 4 4k open_sync writes", 4);
402-
test_open_sync(" 8 2k open_sync writes", 2);
403-
test_open_sync("16 1k open_sync writes", 1);
397+
test_open_sync("16k open_sync write", 16);
398+
test_open_sync(" 8k open_sync writes", 8);
399+
test_open_sync(" 4k open_sync writes", 4);
400+
test_open_sync(" 2k open_sync writes", 2);
401+
test_open_sync(" 1k open_sync writes", 1);
404402
}
405403

406404
/*
@@ -519,7 +517,7 @@ test_non_sync(void)
519517
/*
520518
* Test a simple write without fsync
521519
*/
522-
printf("\nNon-sync'ed 8k writes:\n");
520+
printf("\nNon-sync'ed %dk writes:\n", XLOG_BLCKSZ_K);
523521
printf(LABEL_FORMAT, "write");
524522
fflush(stdout);
525523

0 commit comments

Comments
 (0)