Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf56a9de

Browse files
committed
Fix inconsistency with replay of hash squeeze record for clean buffers
aa5edbe has tweaked _hash_freeovflpage() so as the write buffer'sLSN is updated only when necessary, when REGBUF_NO_CHANGE is not used.The replay code was not consistent with that, causing the write buffer'sLSN to be updated and its page to be marked as dirty even if the bufferwas registered in a "clean" state. This was possible for the case of asqueeze record when there are no tuples to add to the write buffer, for(is_prim_bucket_same_wrt && !is_prev_bucket_same_wrt).I have performed some validation of this commit withwal_consistency_checking and a change in WAL that logs REGBUF_NO_CHANGEto a new BKPIMAGE_*. Thanks to that, it is possible to know at replayif a buffer was clean when it was registered, then cross-checked the LSNof the "clean" page copy coming from WAL with the LSN of the block oncethe record has been replayed. This eats one bit in bimg_info, which isnot acceptable to be integrated as-is, but it could become handy in thefuture. I didn't spot other areas than the one fixed by this commit atthe extent of what the main regression test suite covers.As this is an oversight inaa5edbe, no backpatch is required.Reported-by: Zubeyr EryilmazAuthor: Hayato KurodaReviewed-by: Amit Kapila, Michael PaquierDiscussion:https://postgr.es/m/ZbyVVG_7eW3YD5-A@paquier.xyz
1 parent5392dd3 commitf56a9de

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

‎src/backend/access/hash/hash_xlog.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ hash_xlog_squeeze_page(XLogReaderState *record)
666666
char*data;
667667
Sizedatalen;
668668
uint16ninserted=0;
669+
boolmod_wbuf= false;
669670

670671
data=begin=XLogRecGetBlockData(record,1,&datalen);
671672

@@ -695,6 +696,17 @@ hash_xlog_squeeze_page(XLogReaderState *record)
695696

696697
ninserted++;
697698
}
699+
700+
mod_wbuf= true;
701+
}
702+
else
703+
{
704+
/*
705+
* Ensure that the required flags are set when there are no
706+
* tuples. See _hash_freeovflpage().
707+
*/
708+
Assert(xldata->is_prim_bucket_same_wrt||
709+
xldata->is_prev_bucket_same_wrt);
698710
}
699711

700712
/*
@@ -711,10 +723,15 @@ hash_xlog_squeeze_page(XLogReaderState *record)
711723
HashPageOpaquewriteopaque=HashPageGetOpaque(writepage);
712724

713725
writeopaque->hasho_nextblkno=xldata->nextblkno;
726+
mod_wbuf= true;
714727
}
715728

716-
PageSetLSN(writepage,lsn);
717-
MarkBufferDirty(writebuf);
729+
/* Set LSN and mark writebuf dirty iff it is modified */
730+
if (mod_wbuf)
731+
{
732+
PageSetLSN(writepage,lsn);
733+
MarkBufferDirty(writebuf);
734+
}
718735
}
719736

720737
/* replay the record for initializing overflow buffer */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp