Skip to content

Commit 4b8e24b

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 f7bb7f0 commit 4b8e24b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/backend/access/heap/heapam.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7479,10 +7479,11 @@ heap_xlog_visible(XLogReaderState *record)
74797479
{
74807480
/*
74817481
* We don't bump the LSN of the heap page when setting the visibility
7482-
* map bit (unless checksums are enabled, in which case we must),
7483-
* because that would generate an unworkable volume of full-page
7484-
* writes. This exposes us to torn page hazards, but since we're not
7485-
* inspecting the existing page contents in any way, we don't care.
7482+
* map bit (unless checksums or wal_hint_bits is enabled, in which
7483+
* case we must), because that would generate an unworkable volume of
7484+
* full-page writes. This exposes us to torn page hazards, but since
7485+
* we're not inspecting the existing page contents in any way, we
7486+
* don't care.
74867487
*
74877488
* However, all operations that clear the visibility map bit *do* bump
74887489
* the LSN, and those operations will only be replayed if the XLOG LSN
@@ -7497,10 +7498,10 @@ heap_xlog_visible(XLogReaderState *record)
74977498
else if (action == BLK_RESTORED)
74987499
{
74997500
/*
7500-
* If heap block was backed up, restore it. This can only happen with
7501-
* checksums enabled.
7501+
* If heap block was backed up, we already restored it and there's
7502+
* nothing more to do. (This can only happen with checksums or
7503+
* wal_log_hints enabled.)
75027504
*/
7503-
Assert(DataChecksumsEnabled());
75047505
}
75057506
if (BufferIsValid(buffer))
75067507
UnlockReleaseBuffer(buffer);

src/backend/storage/buffer/bufmgr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,7 @@ BufferGetLSNAtomic(Buffer buffer)
24962496
/*
24972497
* If we don't need locking for correctness, fastpath out.
24982498
*/
2499-
if (!DataChecksumsEnabled() || BufferIsLocal(buffer))
2499+
if (!XLogHintBitIsNeeded() || BufferIsLocal(buffer))
25002500
return PageGetLSN(page);
25012501

25022502
/* 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