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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user