OSDN Git Service

Don't use O_DIRECT when writing WAL files if archiving or streaming is
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 19 Feb 2010 10:51:04 +0000 (10:51 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 19 Feb 2010 10:51:04 +0000 (10:51 +0000)
commitad458cfe81bcefd6d8bd17ff2e42c6599d441bd6
treea4e6d3c89e74fbd65b03103d7a4a575f96f3a6fa
parent94f610b16342d7727774f6bb9245341cfa6f895c
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.
src/backend/access/transam/xlog.c
src/backend/replication/walreceiver.c
src/include/access/xlogdefs.h
src/include/replication/walreceiver.h