Content-Length: 279066 | pFad | http://github.com/postgrespro/postgres_cluster/commit/e1cd66f74862936d84acf3008118d6094c56ad58

05 Reduce impact of btree page reuse on Hot Standby by fixing off-by-1 e… · postgrespro/postgres_cluster@e1cd66f · GitHub
Skip to content

Commit e1cd66f

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 a latestRemovedXid one higher than actually needed because xid used was page opaque->btpo.xact rather than an actually removed xid. Noticed on an otherwise quiet system by Noah Misch. Noah Misch and Simon Riggs
1 parent 9abbed0 commit e1cd66f

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+
TransactionId latestRemovedXid;
564+
563565
BTPageOpaque opaque = (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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/e1cd66f74862936d84acf3008118d6094c56ad58

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy