<!--
-$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.335 2005/07/02 19:16:36 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.336 2005/07/05 23:18:09 momjian Exp $
-->
<chapter Id="runtime">
<para>
This option can only be set at server start or in the
- <filename>postgresql.conf</filename> file.
+ <filename>postgresql.conf</filename> file. If this option
+ is <literal>off</>, consider also turning off
+ <varname>guc-full-page-writes</>.
</para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
+ <varlistentry id="guc-full-page-writes" xreflabel="full_page_writes">
+ <indexterm>
+ <primary><varname>full_page_writes</> configuration parameter</primary>
+ </indexterm>
+ <term><varname>full_page_writes</varname> (<type>boolean</type>)</term>
+ <listitem>
+ <para>
+ A page write in process during an operating system crash might
+ be only partially written to disk, leading to an on-disk page
+ that contains a mix of old and new data. During recovery, the
+ row changes stored in WAL are not enough to completely restore
+ the page.
+ </para>
+
+ <para>
+ When this option is on, the <productname>PostgreSQL</> server
+ writes full pages to WAL when they first modified after a checkpoint
+ so full recovery is possible. Turning this option off might lead
+ to a corrupt system after an operating system crash because
+ uncorrected partial pages might contain inconsistent or corrupt
+ data. The risks are less but similar to <varname>fsync</>.
+ </para>
+
+ <para>
+ This option can only be set at server start or in the
+ <filename>postgresql.conf</filename> file. The default is
+ <literal>on</>.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="guc-wal-buffers" xreflabel="wal_buffers">
<term><varname>wal_buffers</varname> (<type>integer</type>)</term>
<indexterm>
* 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.206 2005/07/04 04:51:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.207 2005/07/05 23:18:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char *XLogArchiveCommand = NULL;
char *XLOG_sync_method = NULL;
const char XLOG_sync_method_default[] = DEFAULT_SYNC_METHOD_STR;
+bool fullPageWrites = true;
#ifdef WAL_DEBUG
bool XLOG_DEBUG = false;
{
/* OK, put it in this slot */
dtbuf[i] = rdt->buffer;
- if (XLogCheckBuffer(rdt, &(dtbuf_lsn[i]), &(dtbuf_xlg[i])))
+ /* If fsync is off, no need to backup pages. */
+ if (fullPageWrites &&
+ XLogCheckBuffer(rdt, &(dtbuf_lsn[i]), &(dtbuf_xlg[i])))
{
dtbuf_bkp[i] = true;
rdt->data = NULL;
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.272 2005/07/04 04:51:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.273 2005/07/05 23:18:10 momjian Exp $
*
*--------------------------------------------------------------------
*/
extern int CommitDelay;
extern int CommitSiblings;
extern char *default_tablespace;
+extern bool fullPageWrites;
static const char *assign_log_destination(const char *value,
bool doit, GucSource source);
&zero_damaged_pages,
false, NULL, NULL
},
+ {
+ {"full_page_writes", PGC_SIGHUP, WAL_SETTINGS,
+ gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),
+ gettext_noop("A page write in process during an operating system crash might be "
+ "only partially written to disk. During recovery, the row changes"
+ "stored in WAL are not enough to recover. This option writes "
+ "pages when first modified after a checkpoint to WAL so full recovery "
+ "is possible.")
+ },
+ &fullPageWrites,
+ true, NULL, NULL
+ },
{
{"silent_mode", PGC_POSTMASTER, LOGGING_WHEN,
gettext_noop("Runs the server silently."),
#wal_sync_method = fsync # the default varies across platforms:
# fsync, fdatasync, fsync_writethrough,
# open_sync, open_datasync
+#full_page_writes = on # recover from partial page writes
#wal_buffers = 8 # min 4, 8KB each
#commit_delay = 0 # range 0-100000, in microseconds
#commit_siblings = 5 # range 1-1000