Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.335
diff -c -c -r1.335 runtime.sgml
*** doc/src/sgml/runtime.sgml 2 Jul 2005 19:16:36 -0000 1.335
--- doc/src/sgml/runtime.sgml 4 Jul 2005 03:58:34 -0000
***************
*** 1687,1692 ****
--- 1687,1723 ----
+
+
+ full_page_writes> configuration parameter
+
+ full_page_writes (boolean)
+
+
+ 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 recover from this
+ situation.
+
+
+
+ When this option is on, the PostgreSQL> server
+ writes full pages when first modified after a checkpoint to WAL
+ 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 fsync>.
+
+
+
+ This option can only be set at server start or in the
+ postgresql.conf file. The default is
+ on>.
+
+
+
+
wal_buffers (integer)
Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.205
diff -c -c -r1.205 xlog.c
*** src/backend/access/transam/xlog.c 30 Jun 2005 00:00:50 -0000 1.205
--- src/backend/access/transam/xlog.c 4 Jul 2005 03:58:38 -0000
***************
*** 97,102 ****
--- 97,103 ----
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;
***************
*** 593,599 ****
{
/* OK, put it in this slot */
dtbuf[i] = rdt->buffer;
! if (XLogCheckBuffer(rdt, &(dtbuf_lsn[i]), &(dtbuf_xlg[i])))
{
dtbuf_bkp[i] = true;
rdt->data = NULL;
--- 594,602 ----
{
/* OK, put it in this slot */
dtbuf[i] = rdt->buffer;
! /* If fsync is off, no need to backup pages. */
! if (enableFsync && fullPageWrites &&
! XLogCheckBuffer(rdt, &(dtbuf_lsn[i]), &(dtbuf_xlg[i])))
{
dtbuf_bkp[i] = true;
rdt->data = NULL;
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.271
diff -c -c -r1.271 guc.c
*** src/backend/utils/misc/guc.c 28 Jun 2005 05:09:02 -0000 1.271
--- src/backend/utils/misc/guc.c 4 Jul 2005 03:58:46 -0000
***************
*** 82,87 ****
--- 82,88 ----
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);
***************
*** 482,487 ****
--- 483,500 ----
false, NULL, NULL
},
{
+ {"full_page_writes", PGC_SIGHUP, WAL_SETTINGS,
+ gettext_noop("Fully writes pages 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 "
Index: src/backend/utils/misc/postgresql.conf.sample
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/postgresql.conf.sample,v
retrieving revision 1.151
diff -c -c -r1.151 postgresql.conf.sample
*** src/backend/utils/misc/postgresql.conf.sample 2 Jul 2005 18:46:45 -0000 1.151
--- src/backend/utils/misc/postgresql.conf.sample 4 Jul 2005 03:58:46 -0000
***************
*** 121,126 ****
--- 121,127 ----
#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