*** a/doc/src/sgml/config.sgml
--- b/doc/src/sgml/config.sgml
***************
*** 1957,1966 **** include 'filename'
!
! wal_log_hintbits (boolean)
! wal_log_hintbits> configuration parameter
--- 1957,1966 ----
!
! wal_log_hints (boolean)
! wal_log_hints> configuration parameter
*** a/src/backend/access/heap/visibilitymap.c
--- b/src/backend/access/heap/visibilitymap.c
***************
*** 287,293 **** visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
cutoff_xid);
/*
! * If data checksums are enabled (or wal_log_hintbits=on), we
* need to protect the heap page from being torn.
*/
if (XLogHintBitIsNeeded())
--- 287,293 ----
cutoff_xid);
/*
! * If data checksums are enabled (or wal_log_hints=on), we
* need to protect the heap page from being torn.
*/
if (XLogHintBitIsNeeded())
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 79,85 **** bool XLogArchiveMode = false;
char *XLogArchiveCommand = NULL;
bool EnableHotStandby = false;
bool fullPageWrites = true;
! bool walLogHintbits = false;
bool log_checkpoints = false;
int sync_method = DEFAULT_SYNC_METHOD;
int wal_level = WAL_LEVEL_MINIMAL;
--- 79,85 ----
char *XLogArchiveCommand = NULL;
bool EnableHotStandby = false;
bool fullPageWrites = true;
! bool walLogHints = false;
bool log_checkpoints = false;
int sync_method = DEFAULT_SYNC_METHOD;
int wal_level = WAL_LEVEL_MINIMAL;
***************
*** 5271,5277 **** BootStrapXLOG(void)
ControlFile->max_prepared_xacts = max_prepared_xacts;
ControlFile->max_locks_per_xact = max_locks_per_xact;
ControlFile->wal_level = wal_level;
! ControlFile->wal_log_hintbits = walLogHintbits;
ControlFile->data_checksum_version = bootstrap_data_checksum_version;
/* some additional ControlFile fields are set in WriteControlFile() */
--- 5271,5277 ----
ControlFile->max_prepared_xacts = max_prepared_xacts;
ControlFile->max_locks_per_xact = max_locks_per_xact;
ControlFile->wal_level = wal_level;
! ControlFile->wal_log_hints = walLogHints;
ControlFile->data_checksum_version = bootstrap_data_checksum_version;
/* some additional ControlFile fields are set in WriteControlFile() */
***************
*** 9060,9066 **** static void
XLogReportParameters(void)
{
if (wal_level != ControlFile->wal_level ||
! walLogHintbits != ControlFile->wal_log_hintbits ||
MaxConnections != ControlFile->MaxConnections ||
max_worker_processes != ControlFile->max_worker_processes ||
max_prepared_xacts != ControlFile->max_prepared_xacts ||
--- 9060,9066 ----
XLogReportParameters(void)
{
if (wal_level != ControlFile->wal_level ||
! walLogHints != ControlFile->wal_log_hints ||
MaxConnections != ControlFile->MaxConnections ||
max_worker_processes != ControlFile->max_worker_processes ||
max_prepared_xacts != ControlFile->max_prepared_xacts ||
***************
*** 9083,9089 **** XLogReportParameters(void)
xlrec.max_prepared_xacts = max_prepared_xacts;
xlrec.max_locks_per_xact = max_locks_per_xact;
xlrec.wal_level = wal_level;
! xlrec.wal_log_hintbits = walLogHintbits;
rdata.buffer = InvalidBuffer;
rdata.data = (char *) &xlrec;
--- 9083,9089 ----
xlrec.max_prepared_xacts = max_prepared_xacts;
xlrec.max_locks_per_xact = max_locks_per_xact;
xlrec.wal_level = wal_level;
! xlrec.wal_log_hints = walLogHints;
rdata.buffer = InvalidBuffer;
rdata.data = (char *) &xlrec;
***************
*** 9098,9104 **** XLogReportParameters(void)
ControlFile->max_prepared_xacts = max_prepared_xacts;
ControlFile->max_locks_per_xact = max_locks_per_xact;
ControlFile->wal_level = wal_level;
! ControlFile->wal_log_hintbits = walLogHintbits;
UpdateControlFile();
}
}
--- 9098,9104 ----
ControlFile->max_prepared_xacts = max_prepared_xacts;
ControlFile->max_locks_per_xact = max_locks_per_xact;
ControlFile->wal_level = wal_level;
! ControlFile->wal_log_hints = walLogHints;
UpdateControlFile();
}
}
***************
*** 9485,9491 **** xlog_redo(XLogRecPtr lsn, XLogRecord *record)
ControlFile->max_prepared_xacts = xlrec.max_prepared_xacts;
ControlFile->max_locks_per_xact = xlrec.max_locks_per_xact;
ControlFile->wal_level = xlrec.wal_level;
! ControlFile->wal_log_hintbits = walLogHintbits;
/*
* Update minRecoveryPoint to ensure that if recovery is aborted, we
--- 9485,9491 ----
ControlFile->max_prepared_xacts = xlrec.max_prepared_xacts;
ControlFile->max_locks_per_xact = xlrec.max_locks_per_xact;
ControlFile->wal_level = xlrec.wal_level;
! ControlFile->wal_log_hints = walLogHints;
/*
* Update minRecoveryPoint to ensure that if recovery is aborted, we
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
***************
*** 872,882 **** static struct config_bool ConfigureNamesBool[] =
},
{
! {"wal_log_hintbits", PGC_POSTMASTER, WAL_SETTINGS,
gettext_noop("Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modifications"),
NULL
},
! &walLogHintbits,
false,
NULL, NULL, NULL
},
--- 872,882 ----
},
{
! {"wal_log_hints", PGC_POSTMASTER, WAL_SETTINGS,
gettext_noop("Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modifications"),
NULL
},
! &walLogHints,
false,
NULL, NULL, NULL
},
*** a/src/backend/utils/misc/postgresql.conf.sample
--- b/src/backend/utils/misc/postgresql.conf.sample
***************
*** 184,190 ****
# fsync_writethrough
# open_sync
#full_page_writes = on # recover from partial page writes
! #wal_log_hintbits = off # also do full pages writes of non-critical updates
#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
# (change requires restart)
#wal_writer_delay = 200ms # 1-10000 milliseconds
--- 184,190 ----
# fsync_writethrough
# open_sync
#full_page_writes = on # recover from partial page writes
! #wal_log_hints = off # also do full pages writes of non-critical updates
#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
# (change requires restart)
#wal_writer_delay = 200ms # 1-10000 milliseconds
*** a/src/bin/pg_controldata/pg_controldata.c
--- b/src/bin/pg_controldata/pg_controldata.c
***************
*** 260,267 **** main(int argc, char *argv[])
ControlFile.backupEndRequired ? _("yes") : _("no"));
printf(_("Current wal_level setting: %s\n"),
wal_level_str(ControlFile.wal_level));
! printf(_("Current wal_log_hintbits setting: %s\n"),
! ControlFile.wal_log_hintbits ? _("on") : _("off"));
printf(_("Current max_connections setting: %d\n"),
ControlFile.MaxConnections);
printf(_("Current max_worker_processes setting: %d\n"),
--- 260,267 ----
ControlFile.backupEndRequired ? _("yes") : _("no"));
printf(_("Current wal_level setting: %s\n"),
wal_level_str(ControlFile.wal_level));
! printf(_("Current wal_log_hints setting: %s\n"),
! ControlFile.wal_log_hints ? _("on") : _("off"));
printf(_("Current max_connections setting: %d\n"),
ControlFile.MaxConnections);
printf(_("Current max_worker_processes setting: %d\n"),
*** a/src/bin/pg_resetxlog/pg_resetxlog.c
--- b/src/bin/pg_resetxlog/pg_resetxlog.c
***************
*** 525,531 **** GuessControlValues(void)
/* minRecoveryPoint, backupStartPoint and backupEndPoint can be left zero */
ControlFile.wal_level = WAL_LEVEL_MINIMAL;
! ControlFile.wal_log_hintbits = false;
ControlFile.MaxConnections = 100;
ControlFile.max_worker_processes = 8;
ControlFile.max_prepared_xacts = 0;
--- 525,531 ----
/* minRecoveryPoint, backupStartPoint and backupEndPoint can be left zero */
ControlFile.wal_level = WAL_LEVEL_MINIMAL;
! ControlFile.wal_log_hints = false;
ControlFile.MaxConnections = 100;
ControlFile.max_worker_processes = 8;
ControlFile.max_prepared_xacts = 0;
***************
*** 722,728 **** RewriteControlFile(void)
* anyway at startup.
*/
ControlFile.wal_level = WAL_LEVEL_MINIMAL;
! ControlFile.wal_log_hintbits = false;
ControlFile.MaxConnections = 100;
ControlFile.max_worker_processes = 8;
ControlFile.max_prepared_xacts = 0;
--- 722,728 ----
* anyway at startup.
*/
ControlFile.wal_level = WAL_LEVEL_MINIMAL;
! ControlFile.wal_log_hints = false;
ControlFile.MaxConnections = 100;
ControlFile.max_worker_processes = 8;
ControlFile.max_prepared_xacts = 0;
*** a/src/include/access/xlog.h
--- b/src/include/access/xlog.h
***************
*** 189,195 **** extern bool XLogArchiveMode;
extern char *XLogArchiveCommand;
extern bool EnableHotStandby;
extern bool fullPageWrites;
! extern bool walLogHintbits;
extern bool log_checkpoints;
extern int num_xloginsert_slots;
--- 189,195 ----
extern char *XLogArchiveCommand;
extern bool EnableHotStandby;
extern bool fullPageWrites;
! extern bool walLogHints;
extern bool log_checkpoints;
extern int num_xloginsert_slots;
***************
*** 219,227 **** extern int wal_level;
* we have to protect them against torn page writes. When you only set
* individual bits on a page, it's still consistent no matter what combination
* of the bits make it to disk, but the checksum wouldn't match. Also WAL-log
! * them if forced by wal_log_hintbits=on.
*/
! #define XLogHintBitIsNeeded() (DataChecksumsEnabled() || walLogHintbits)
/* Do we need to WAL-log information required only for Hot Standby and logical replication? */
#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY)
--- 219,227 ----
* we have to protect them against torn page writes. When you only set
* individual bits on a page, it's still consistent no matter what combination
* of the bits make it to disk, but the checksum wouldn't match. Also WAL-log
! * them if forced by wal_log_hints=on.
*/
! #define XLogHintBitIsNeeded() (DataChecksumsEnabled() || walLogHints)
/* Do we need to WAL-log information required only for Hot Standby and logical replication? */
#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY)
*** a/src/include/access/xlog_internal.h
--- b/src/include/access/xlog_internal.h
***************
*** 209,215 **** typedef struct xl_parameter_change
int max_prepared_xacts;
int max_locks_per_xact;
int wal_level;
! bool wal_log_hintbits;
} xl_parameter_change;
/* logs restore point */
--- 209,215 ----
int max_prepared_xacts;
int max_locks_per_xact;
int wal_level;
! bool wal_log_hints;
} xl_parameter_change;
/* logs restore point */
*** a/src/include/catalog/pg_control.h
--- b/src/include/catalog/pg_control.h
***************
*** 171,177 **** typedef struct ControlFileData
* or hot standby.
*/
int wal_level;
! bool wal_log_hintbits;
int MaxConnections;
int max_worker_processes;
int max_prepared_xacts;
--- 171,177 ----
* or hot standby.
*/
int wal_level;
! bool wal_log_hints;
int MaxConnections;
int max_worker_processes;
int max_prepared_xacts;