values are
fsync> (call fsync()> at each commit),
fdatasync> (call fdatasync()> at each commit),
+ fsync_writethrough> (call _commit()> at each commit on Windows),
open_sync> (write WAL files with open()> option O_SYNC>), and
open_datasync> (write WAL files with open()> option O_DSYNC>).
Not all of these choices are available on all platforms.
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.181 2005/02/12 23:53:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.182 2005/03/24 04:36:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#endif
#endif
+#if defined(O_DSYNC)
#if defined(OPEN_SYNC_FLAG)
-#if defined(O_DSYNC) && (O_DSYNC != OPEN_SYNC_FLAG)
+#if O_DSYNC != OPEN_SYNC_FLAG
+#define OPEN_DATASYNC_FLAG O_DSYNC
+#endif
+#else /* !defined(OPEN_SYNC_FLAG) */
+/* Win32 only has O_DSYNC */
#define OPEN_DATASYNC_FLAG O_DSYNC
#endif
#endif
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
#define DEFAULT_SYNC_FLAGBIT 0
#else
+#ifndef FSYNC_IS_WRITE_THROUGH
#define DEFAULT_SYNC_METHOD_STR "fsync"
+#else
+#define DEFAULT_SYNC_METHOD_STR "fsync_writethrough"
+#endif
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC
#define DEFAULT_SYNC_FLAGBIT 0
#endif
int new_sync_method;
int new_sync_bit;
+#ifndef FSYNC_IS_WRITE_THROUGH
if (pg_strcasecmp(method, "fsync") == 0)
+#else
+ /* Win32 fsync() == _commit(0, which writes through a write cache */
+ if (pg_strcasecmp(method, "fsync_writethrough") == 0)
+#endif
{
new_sync_method = SYNC_METHOD_FSYNC;
new_sync_bit = 0;
#fsync = true # turns forced synchronization on or off
#wal_sync_method = fsync # the default varies across platforms:
- # fsync, fdatasync, open_sync, or open_datasync
+ # fsync, fdatasync, fsync_writethrough,
+ # open_sync, open_datasync
#wal_buffers = 8 # min 4, 8KB each
#commit_delay = 0 # range 0-100000, in microseconds
#commit_siblings = 5 # range 1-1000
-/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.43 2005/02/27 00:53:29 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.44 2005/03/24 04:36:19 momjian Exp $ */
/* undefine and redefine after #include */
#undef mkdir
#define fsync(a) _commit(a)
+#define FSYNC_IS_WRITE_THROUGH
#define ftruncate(a,b) chsize(a,b)
#define USES_WINSOCK
* to ensure that we don't collide with a future definition. It means
* we cannot use _O_NOINHERIT ourselves.
*/
-#define O_SYNC 0x0080
+#define O_DSYNC 0x0080
/*
* Supplement to .
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/port/open.c,v 1.8 2005/02/27 00:53:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/open.c,v 1.9 2005/03/24 04:36:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* Check that we can handle the request */
assert((fileFlags & ((O_RDONLY | O_WRONLY | O_RDWR) | O_APPEND |
(O_RANDOM | O_SEQUENTIAL | O_TEMPORARY) |
- _O_SHORT_LIVED | O_SYNC |
+ _O_SHORT_LIVED | O_DSYNC |
(O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags);
sa.nLength = sizeof(sa);
((fileFlags & O_SEQUENTIAL) ? FILE_FLAG_SEQUENTIAL_SCAN : 0) |
((fileFlags & _O_SHORT_LIVED) ? FILE_ATTRIBUTE_TEMPORARY : 0) |
((fileFlags & O_TEMPORARY) ? FILE_FLAG_DELETE_ON_CLOSE : 0)|
- ((fileFlags & O_SYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
+ ((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
NULL)) == INVALID_HANDLE_VALUE)
{
switch (GetLastError())