mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +03:00
Remove block number field from nbtree stack.
The initial value of the nbtree stack downlink block number field recorded during an initial descent of the tree wasn't actually used. Both _bt_getstackbuf() callers overwrote the value with their own value. Remove the block number field from the stack struct, and add a child block number argument to _bt_getstackbuf() in its place. This makes the overall design of _bt_getstackbuf() clearer. Author: Peter Geoghegan Reviewed-By: Anastasia Lubennikova Discussion: https://postgr.es/m/CAH2-Wzmx+UbXt2YNOUCZ-a04VdXU=S=OHuAuD7Z8uQq-PXTYUg@mail.gmail.com
This commit is contained in:
@@ -403,20 +403,16 @@ typedef struct BTMetaPageData
|
||||
#define BT_WRITE BUFFER_LOCK_EXCLUSIVE
|
||||
|
||||
/*
|
||||
* BTStackData -- As we descend a tree, we push the (location, downlink)
|
||||
* pairs from internal pages onto a private stack. If we split a
|
||||
* leaf, we use this stack to walk back up the tree and insert data
|
||||
* into parent pages (and possibly to split them, too). Lehman and
|
||||
* Yao's update algorithm guarantees that under no circumstances can
|
||||
* our private stack give us an irredeemably bad picture up the tree.
|
||||
* Again, see the paper for details.
|
||||
* BTStackData -- As we descend a tree, we push the location of pivot
|
||||
* tuples whose downlink we are about to follow onto a private stack. If
|
||||
* we split a leaf, we use this stack to walk back up the tree and insert
|
||||
* data into its parent page at the correct location. We may also have to
|
||||
* recursively split a grandparent of the leaf page (and so on).
|
||||
*/
|
||||
|
||||
typedef struct BTStackData
|
||||
{
|
||||
BlockNumber bts_blkno;
|
||||
OffsetNumber bts_offset;
|
||||
BlockNumber bts_btentry;
|
||||
struct BTStackData *bts_parent;
|
||||
} BTStackData;
|
||||
|
||||
@@ -731,7 +727,7 @@ extern void _bt_parallel_advance_array_keys(IndexScanDesc scan);
|
||||
*/
|
||||
extern bool _bt_doinsert(Relation rel, IndexTuple itup,
|
||||
IndexUniqueCheck checkUnique, Relation heapRel);
|
||||
extern Buffer _bt_getstackbuf(Relation rel, BTStack stack);
|
||||
extern Buffer _bt_getstackbuf(Relation rel, BTStack stack, BlockNumber child);
|
||||
extern void _bt_finish_split(Relation rel, Buffer bbuf, BTStack stack);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user