mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
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/ZbyVVG_7eW3YD5-A@paquier.xyz
This commit is contained in:
parent
22f7e61a63
commit
aa5edbe379
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user