Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5b2f2af

Browse files
nbtree page deletion: Add leaftopparent assertion.
Add documenting assertion. This makes it easier to follow how we maintain the top parent link in target subtree's half-dead/leaf level page.
1 parent 3d8d578 commit 5b2f2af

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/backend/access/nbtree/nbtpage.c

+3
Original file line numberDiff line numberDiff line change
@@ -2458,6 +2458,9 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, BlockNumber scanblkno,
24582458
leaftopparent = InvalidBlockNumber;
24592459
}
24602460

2461+
/* No leaftopparent for level 0 (leaf page) or level 1 target */
2462+
Assert(!BlockNumberIsValid(leaftopparent) || targetlevel > 1);
2463+
24612464
/*
24622465
* And next write-lock the (current) right sibling.
24632466
*/

src/backend/access/nbtree/nbtxlog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ btree_xlog_unlink_page(uint8 info, XLogReaderState *record)
818818
safexid = xlrec->safexid;
819819

820820
/* No leaftopparent for level 0 (leaf page) or level 1 target */
821-
Assert(xlrec->leaftopparent == InvalidBlockNumber || level > 1);
821+
Assert(!BlockNumberIsValid(xlrec->leaftopparent) || level > 1);
822822

823823
/*
824824
* In normal operation, we would lock all the pages this WAL record

0 commit comments

Comments
 (0)