summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmit Kapila2024-02-07 05:40:12 +0000
committerAmit Kapila2024-02-07 05:40:12 +0000
commitaa5edbe379d645e980f927b01379bdad9bc6c295 (patch)
treede37447b6c81d32dbe72dfac36aff6bab5e82590 /src
parent22f7e61a63306873211e26c7bac9c68631309aef (diff)
Set LSN for wbuf in _hash_freeovflpage() iff wbuf is modified.
Commit 861f86beea 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/[email protected]
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/hash/hashovfl.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c
index b512d0bcb66..c280ae885e3 100644
--- a/src/backend/access/hash/hashovfl.c
+++ b/src/backend/access/hash/hashovfl.c
@@ -647,6 +647,7 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
xl_hash_squeeze_page xlrec;
XLogRecPtr recptr;
int i;
+ bool mod_wbuf = false;
xlrec.prevblkno = prevblkno;
xlrec.nextblkno = nextblkno;
@@ -671,6 +672,10 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
if (xlrec.ntups > 0)
{
XLogRegisterBuffer(1, wbuf, REGBUF_STANDARD);
+
+ /* Remember that wbuf is modified. */
+ mod_wbuf = true;
+
XLogRegisterBufData(1, (char *) itup_offsets,
nitups * sizeof(OffsetNumber));
for (i = 0; i < nitups; i++)
@@ -690,7 +695,14 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
wbuf_flags = REGBUF_STANDARD;
if (!xlrec.is_prev_bucket_same_wrt)
+ {
wbuf_flags |= REGBUF_NO_CHANGE;
+ }
+ else
+ {
+ /* Remember that wbuf is modified. */
+ mod_wbuf = true;
+ }
XLogRegisterBuffer(1, wbuf, wbuf_flags);
}
@@ -719,7 +731,10 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf,
recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_SQUEEZE_PAGE);
- PageSetLSN(BufferGetPage(wbuf), recptr);
+ /* Set LSN iff wbuf is modified. */
+ if (mod_wbuf)
+ PageSetLSN(BufferGetPage(wbuf), recptr);
+
PageSetLSN(BufferGetPage(ovflbuf), recptr);
if (BufferIsValid(prevbuf) && !xlrec.is_prev_bucket_same_wrt)