Skip to content

Commit b6c4b58

Browse files
committed
Fix a couple of bugs with wal_log_hints.
1. Replay of the WAL record for setting a bit in the visibility map contained an assertion that a full-page image of that record type can only occur with checksums enabled. But it can also happen with wal_log_hints, so remove the assertion. Unlike checksums, wal_log_hints can be changed on the fly, so it would be complicated to figure out if it was enabled at the time that the WAL record was generated. 2. wal_log_hints has the same effect on the locking needed to read the LSN of a page as data checksums. BufferGetLSNAtomic() didn't get the memo. Backpatch to 9.4, where wal_log_hints was added.
1 parent 8364510 commit b6c4b58

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/backend/access/heap/heapam.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7413,12 +7413,11 @@ heap_xlog_visible(XLogRecPtr lsn, XLogRecord *record)
74137413
ResolveRecoveryConflictWithSnapshot(xlrec->cutoff_xid, xlrec->node);
74147414

74157415
/*
7416-
* If heap block was backed up, restore it. This can only happen with
7417-
* checksums enabled.
7416+
* If heap block was backed up, restore it. (This can only happen with
7417+
* checksums or wal_log_hints enabled).
74187418
*/
74197419
if (record->xl_info & XLR_BKP_BLOCK(1))
74207420
{
7421-
Assert(DataChecksumsEnabled());
74227421
(void) RestoreBackupBlock(lsn, record, 1, false, false);
74237422
}
74247423
else
@@ -7441,11 +7440,11 @@ heap_xlog_visible(XLogRecPtr lsn, XLogRecord *record)
74417440

74427441
/*
74437442
* We don't bump the LSN of the heap page when setting the
7444-
* visibility map bit (unless checksums are enabled, in which case
7445-
* we must), because that would generate an unworkable volume of
7446-
* full-page writes. This exposes us to torn page hazards, but
7447-
* since we're not inspecting the existing page contents in any
7448-
* way, we don't care.
7443+
* visibility map bit (unless checksums or wal_log_hints is
7444+
* enabled, in which case we must), because that would generate an
7445+
* unworkable volume of full-page writes. This exposes us to torn
7446+
* page hazards, but since we're not inspecting the existing page
7447+
* contents in any way, we don't care.
74497448
*
74507449
* However, all operations that clear the visibility map bit *do*
74517450
* bump the LSN, and those operations will only be replayed if the

src/backend/storage/buffer/bufmgr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2125,7 +2125,7 @@ BufferGetLSNAtomic(Buffer buffer)
21252125
/*
21262126
* If we don't need locking for correctness, fastpath out.
21272127
*/
2128-
if (!DataChecksumsEnabled() || BufferIsLocal(buffer))
2128+
if (!XLogHintBitIsNeeded() || BufferIsLocal(buffer))
21292129
return PageGetLSN(page);
21302130

21312131
/* Make sure we've got a real buffer, and that we hold a pin on it. */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy