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

Commitd0c2860

Browse files
committed
Remove wal_sync_method=fsync_writethrough on Windows.
The "fsync" level already flushes drive write caches on Windows (as does"fdatasync"), so it only confuses matters to have an apparently higherlevel that isn't actually different at all.That leaves "fsync_writethrough" only for macOS, where it actually doessomething different.Reviewed-by: Magnus Hagander <magnus@hagander.net>Discussion:https://postgr.es/m/CA%2BhUKGJ2CG2SouPv2mca2WCTOJxYumvBARRcKPraFMB6GSEMcA%40mail.gmail.com
1 parentaea7fe3 commitd0c2860

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

‎doc/src/sgml/wal.sgml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@
109109
<literal>open_datasync</literal> (the default), write caching can be disabled
110110
by unchecking <literal>My Computer\Open\<replaceable>disk drive</replaceable>\Properties\Hardware\Properties\Policies\Enable write caching on the disk</literal>.
111111
Alternatively, set <varname>wal_sync_method</varname> to
112-
<literal>fdatasync</literal> (NTFS only), <literal>fsync</literal> or
113-
<literal>fsync_writethrough</literal>, which prevent
114-
write caching.
112+
<literal>fdatasync</literal> (NTFS only) or <literal>fsync</literal>,
113+
which prevent write caching.
115114
</para>
116115
</listitem>
117116

‎src/backend/storage/file/fd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ pg_fsync(int fd)
399399
#endif
400400

401401
/* #if is to skip the sync_method test if there's no need for it */
402-
#if defined(HAVE_FSYNC_WRITETHROUGH)&& !defined(FSYNC_WRITETHROUGH_IS_FSYNC)
402+
#if defined(HAVE_FSYNC_WRITETHROUGH)
403403
if (sync_method==SYNC_METHOD_FSYNC_WRITETHROUGH)
404404
returnpg_fsync_writethrough(fd);
405405
else
@@ -437,9 +437,7 @@ pg_fsync_writethrough(int fd)
437437
{
438438
if (enableFsync)
439439
{
440-
#ifdefWIN32
441-
return_commit(fd);
442-
#elif defined(F_FULLFSYNC)
440+
#if defined(F_FULLFSYNC)
443441
return (fcntl(fd,F_FULLFSYNC,0)==-1) ?-1 :0;
444442
#else
445443
errno=ENOSYS;

‎src/bin/pg_test_fsync/pg_test_fsync.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,7 @@ signal_cleanup(SIGNAL_ARGS)
605605
staticint
606606
pg_fsync_writethrough(intfd)
607607
{
608-
#ifdefWIN32
609-
return_commit(fd);
610-
#elif defined(F_FULLFSYNC)
608+
#if defined(F_FULLFSYNC)
611609
return (fcntl(fd,F_FULLFSYNC,0)==-1) ?-1 :0;
612610
#else
613611
errno=ENOSYS;

‎src/include/port/win32_port.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@
8484
/* Windows doesn't have fsync() as such, use _commit() */
8585
#definefsync(fd) _commit(fd)
8686

87-
/*
88-
* For historical reasons, we allow setting wal_sync_method to
89-
* fsync_writethrough on Windows, even though it's really identical to fsync
90-
* (both code paths wind up at _commit()).
91-
*/
92-
#defineHAVE_FSYNC_WRITETHROUGH
93-
#defineFSYNC_WRITETHROUGH_IS_FSYNC
94-
9587
#defineUSES_WINSOCK
9688

9789
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp