summaryrefslogtreecommitdiff
path: root/src/include/access/xlogdefs.h
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-02-19 10:51:04 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-02-19 10:51:04 +0000
commitad458cfe81bcefd6d8bd17ff2e42c6599d441bd6 (patch)
treea4e6d3c89e74fbd65b03103d7a4a575f96f3a6fa /src/include/access/xlogdefs.h
parent94f610b16342d7727774f6bb9245341cfa6f895c (diff)
Don't use O_DIRECT when writing WAL files if archiving or streaming is
enabled. Bypassing the kernel cache is counter-productive in that case, because the archiver/walsender process will read from the WAL file soon after it's written, and if it's not cached the read will cause a physical read, eating I/O bandwidth available on the WAL drive. Also, walreceiver process does unaligned writes, so disable O_DIRECT in walreceiver process for that reason too.
Diffstat (limited to 'src/include/access/xlogdefs.h')
-rw-r--r--src/include/access/xlogdefs.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h
index 8ecc3a21b1c..0760b259308 100644
--- a/src/include/access/xlogdefs.h
+++ b/src/include/access/xlogdefs.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.25 2010/01/15 09:19:06 heikki Exp $
+ * $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.26 2010/02/19 10:51:04 heikki Exp $
*/
#ifndef XLOG_DEFS_H
#define XLOG_DEFS_H
@@ -106,23 +106,20 @@ typedef uint32 TimeLineID;
* configure determined whether fdatasync() is.
*/
#if defined(O_SYNC)
-#define BARE_OPEN_SYNC_FLAG O_SYNC
+#define OPEN_SYNC_FLAG O_SYNC
#elif defined(O_FSYNC)
-#define BARE_OPEN_SYNC_FLAG O_FSYNC
-#endif
-#ifdef BARE_OPEN_SYNC_FLAG
-#define OPEN_SYNC_FLAG (BARE_OPEN_SYNC_FLAG | PG_O_DIRECT)
+#define OPEN_SYNC_FLAG O_FSYNC
#endif
#if defined(O_DSYNC)
#if defined(OPEN_SYNC_FLAG)
/* O_DSYNC is distinct? */
-#if O_DSYNC != BARE_OPEN_SYNC_FLAG
-#define OPEN_DATASYNC_FLAG (O_DSYNC | PG_O_DIRECT)
+#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 | PG_O_DIRECT)
+#define OPEN_DATASYNC_FLAG O_DSYNC
#endif
#endif