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

Commite1cd66f

Browse files
Reduce impact of btree page reuse on Hot Standby by fixing off-by-1 error.
WAL records of type XLOG_BTREE_REUSE_PAGE were generated using alatestRemovedXid one higher than actually needed because xid used waspage opaque->btpo.xact rather than an actually removed xid.Noticed on an otherwise quiet system by Noah Misch.Noah Misch and Simon Riggs
1 parent9abbed0 commite1cd66f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎src/backend/access/nbtree/nbtpage.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,19 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
560560
*/
561561
if (XLogStandbyInfoActive())
562562
{
563+
TransactionIdlatestRemovedXid;
564+
563565
BTPageOpaqueopaque= (BTPageOpaque)PageGetSpecialPointer(page);
564566

565-
_bt_log_reuse_page(rel,blkno,opaque->btpo.xact);
567+
/*
568+
* opaque->btpo.xact is the threshold value not the
569+
* value to measure conflicts against. We must retreat
570+
* by one from it to get the correct conflict xid.
571+
*/
572+
latestRemovedXid=opaque->btpo.xact;
573+
TransactionIdRetreat(latestRemovedXid);
574+
575+
_bt_log_reuse_page(rel,blkno,latestRemovedXid);
566576
}
567577

568578
/* Okay to use page. Re-initialize and return it */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp