Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit64bc872

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 outputlayout.
1 parenta91c950 commit64bc872

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

‎contrib/pg_test_fsync/pg_test_fsync.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
*/
2121
#defineFSYNC_FILENAME"./pg_test_fsync.out"
2222

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

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

6260
test_open();
6361

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

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

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

179177
if (writes_per_op==1)
180-
printf("\nCompare file sync methods using one8k 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 two8k 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(" 116k open_sync write",16);
400-
test_open_sync("28k open_sync writes",8);
401-
test_open_sync("44k open_sync writes",4);
402-
test_open_sync("82k 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'ed8k 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)

[8]ページ先頭

©2009-2025 Movatter.jp