aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-12-13 16:26:14 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2013-12-13 16:26:14 +0200
commit50e547096c4858a68abf09894667a542cc418315 (patch)
tree4d1005e1b0d33cd43eb9ff872f5f92275938b20c /src/backend/storage/buffer/bufmgr.c
parent56afe8509ec3057e06ebe244e51272511f05decb (diff)
downloadpostgresql-50e547096c4858a68abf09894667a542cc418315.tar.gz
postgresql-50e547096c4858a68abf09894667a542cc418315.zip
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.
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index f8483918116..081165faef0 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -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.