mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +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:
@ -2626,16 +2626,15 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
|
||||
bool delayChkpt = false;
|
||||
|
||||
/*
|
||||
* If checksums are enabled, and the buffer is permanent, then a full
|
||||
* page image may be required even for some hint bit updates to
|
||||
* protect against torn pages. This full page image is only necessary
|
||||
* If we need to protect hint bit updates from torn writes, WAL-log a
|
||||
* full page image of the page. This full page image is only necessary
|
||||
* if the hint bit update is the first change to the page since the
|
||||
* last checkpoint.
|
||||
*
|
||||
* We don't check full_page_writes here because that logic is included
|
||||
* when we call XLogInsert() since the value changes dynamically.
|
||||
*/
|
||||
if (DataChecksumsEnabled() && (bufHdr->flags & BM_PERMANENT))
|
||||
if (XLogHintBitIsNeeded() && (bufHdr->flags & BM_PERMANENT))
|
||||
{
|
||||
/*
|
||||
* If we're in recovery we cannot dirty a page because of a hint.
|
||||
|
Reference in New Issue
Block a user