1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

Add GUC to enable WAL-logging of hint bits, even with checksums disabled.

WAL records of hint bit updates is useful to tools that want to examine
which pages have been modified. In particular, this is required to make
the pg_rewind tool safe (without checksums).

This can also be used to test how much extra WAL-logging would occur if
you enabled checksums, without actually enabling them (which you can't
currently do without re-initdb'ing).

Sawada Masahiko, docs by Samrat Revagade. Reviewed by Dilip Kumar, with
further changes by me.
This commit is contained in:
Heikki Linnakangas
2013-12-13 16:26:14 +02:00
parent 56afe8509e
commit 50e547096c
13 changed files with 70 additions and 9 deletions

View File

@@ -189,6 +189,7 @@ extern bool XLogArchiveMode;
extern char *XLogArchiveCommand;
extern bool EnableHotStandby;
extern bool fullPageWrites;
extern bool walLogHintbits;
extern bool log_checkpoints;
extern int num_xloginsert_slots;
@@ -211,6 +212,17 @@ extern int wal_level;
*/
#define XLogIsNeeded() (wal_level >= WAL_LEVEL_ARCHIVE)
/*
* Is a full-page image needed for hint bit updates?
*
* Normally, we don't WAL-log hint bit updates, but if checksums are enabled,
* 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)

View File

@@ -209,6 +209,7 @@ 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 */