Skip to content

Commit aa5edbe

Browse files
author
Amit Kapila
committed
Set LSN for wbuf in _hash_freeovflpage() iff wbuf is modified.
Commit 861f86b used REGBUF_NO_CHANGE at one of the places in the hash index to register the clean buffers but forgot to avoid setting LSN in that case. Reported-by: Michael Paquier Author: Kuroda Hayato Reviewed-by: Amit Kapila, Michael Paquier Discussion: https://postgr.es/m/ZbyVVG_7eW3YD5-A@paquier.xyz
1 parent 22f7e61 commit aa5edbe

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/backend/access/hash/hashovfl.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
647647
xl_hash_squeeze_page xlrec;
648648
XLogRecPtr recptr;
649649
int i;
650+
bool mod_wbuf = false;
650651

651652
xlrec.prevblkno = prevblkno;
652653
xlrec.nextblkno = nextblkno;
@@ -671,6 +672,10 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
671672
if (xlrec.ntups > 0)
672673
{
673674
XLogRegisterBuffer(1, wbuf, REGBUF_STANDARD);
675+
676+
/* Remember that wbuf is modified. */
677+
mod_wbuf = true;
678+
674679
XLogRegisterBufData(1, (char *) itup_offsets,
675680
nitups * sizeof(OffsetNumber));
676681
for (i = 0; i < nitups; i++)
@@ -690,7 +695,14 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
690695

691696
wbuf_flags = REGBUF_STANDARD;
692697
if (!xlrec.is_prev_bucket_same_wrt)
698+
{
693699
wbuf_flags |= REGBUF_NO_CHANGE;
700+
}
701+
else
702+
{
703+
/* Remember that wbuf is modified. */
704+
mod_wbuf = true;
705+
}
694706
XLogRegisterBuffer(1, wbuf, wbuf_flags);
695707
}
696708

@@ -719,7 +731,10 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
719731

720732
recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SQUEEZE_PAGE);
721733

722-
PageSetLSN(BufferGetPage(wbuf), recptr);
734+
/* Set LSN iff wbuf is modified. */
735+
if (mod_wbuf)
736+
PageSetLSN(BufferGetPage(wbuf), recptr);
737+
723738
PageSetLSN(BufferGetPage(ovflbuf), recptr);
724739

725740
if (BufferIsValid(prevbuf) && !xlrec.is_prev_bucket_same_wrt)

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