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

Commit5c73ae1

Browse files
Reset btpo.xact following recovery of btree delete page. Add btpo_xact
field into WAL record and reset it from there, rather than usingFrozenTransactionId which can lead to some corner case bugs.Problem report and suggested route to a fix from Heikki, details by me.
1 parent2827516 commit5c73ae1

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.120 2010/02/26 02:00:34 momjian Exp $
12+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.121 2010/03/19 10:41:21 sriggs Exp $
1313
*
1414
*NOTES
1515
* Postgres btree pages look like ordinary relation pages.The opaque
@@ -1301,6 +1301,7 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack)
13011301
xlrec.deadblk=target;
13021302
xlrec.leftblk=leftsib;
13031303
xlrec.rightblk=rightsib;
1304+
xlrec.btpo_xact=opaque->btpo.xact;
13041305

13051306
rdata[0].data= (char*)&xlrec;
13061307
rdata[0].len=SizeOfBtreeDeletePage;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.62 2010/02/26 02:00:34 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.63 2010/03/19 10:41:22 sriggs Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -729,7 +729,7 @@ btree_xlog_delete_page(uint8 info, XLogRecPtr lsn, XLogRecord *record)
729729

730730
pageop->btpo_prev=leftsib;
731731
pageop->btpo_next=rightsib;
732-
pageop->btpo.xact=FrozenTransactionId;
732+
pageop->btpo.xact=xlrec->btpo_xact;
733733
pageop->btpo_flags=BTP_DELETED;
734734
pageop->btpo_cycleid=0;
735735

‎src/include/access/nbtree.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.130 2010/02/26 02:01:21 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.131 2010/03/19 10:41:22 sriggs Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -375,14 +375,15 @@ typedef struct xl_btree_vacuum
375375
* identifies the tuple removed from the parent page (note that we remove
376376
* this tuple's downlink and the *following* tuple's key).Note we do not
377377
* store any content for the deleted page --- it is just rewritten as empty
378-
* during recovery.
378+
* during recovery, apart from resetting the btpo.xact.
379379
*/
380380
typedefstructxl_btree_delete_page
381381
{
382382
xl_btreetidtarget;/* deleted tuple id in parent page */
383383
BlockNumberdeadblk;/* child block being deleted */
384384
BlockNumberleftblk;/* child block's left sibling, if any */
385385
BlockNumberrightblk;/* child block's right sibling */
386+
TransactionIdbtpo_xact;/* value of btpo.xact for use in recovery */
386387
/* xl_btree_metadata FOLLOWS IF XLOG_BTREE_DELETE_PAGE_META */
387388
}xl_btree_delete_page;
388389

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp