summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-07-05 23:18:10 +0000
committerBruce Momjian <bruce@momjian.us>2005-07-05 23:18:10 +0000
commit326a7a0788b4e3c18d4e7008e3943bdb81a21769 (patch)
treecb59060baf5f2566eb681258f620afa2c13e5553 /src
parentc19aa704c84e660c73fb45e0d3f38d0840f17823 (diff)
downloadpostgresql-326a7a0788b4e3c18d4e7008e3943bdb81a21769.tar.gz
Add GUC full_page_writes to control writing full pages to WAL.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c7
-rw-r--r--src/backend/utils/misc/guc.c15
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample1
3 files changed, 20 insertions, 3 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index d42aa93c54..86e1e6878b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -103,6 +103,7 @@ int XLOGbuffers = 8;
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;
@@ -594,7 +595,9 @@ begin:;
{
/* 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;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 0ea335770c..ca59f6755b 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* 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 $
*
*--------------------------------------------------------------------
*/
@@ -83,6 +83,7 @@ extern DLLIMPORT bool check_function_bodies;
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);
@@ -483,6 +484,18 @@ static struct config_bool ConfigureNamesBool[] =
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."),
gettext_noop("If this parameter is set, the server will automatically run in the "
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 4e7c9207dd..193b0303b3 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -121,6 +121,7 @@
#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