!4268 回退 'Pull Request !4082 : 【代码同步】减少btree部分分支计算 #3928'

Merge pull request !4268 from zhangxubo/revert-merge-4082-master
This commit is contained in:
opengauss_bot
2023-10-11 04:06:51 +00:00
committed by Gitee
2 changed files with 7 additions and 3 deletions

View File

@ -83,6 +83,7 @@ BTStack _bt_search(Relation rel, BTScanInsert key, Buffer *bufP, int access, boo
ItemId itemid;
IndexTuple itup;
BlockNumber blkno;
BlockNumber par_blkno;
BTStack new_stack = NULL;
/*
@ -113,6 +114,7 @@ BTStack _bt_search(Relation rel, BTScanInsert key, Buffer *bufP, int access, boo
itemid = PageGetItemId(page, offnum);
itup = (IndexTuple)PageGetItem(page, itemid);
blkno = BTreeInnerTupleGetDownLink(itup);
par_blkno = BufferGetBlockNumber(*bufP);
/*
* We need to save the location of the index entry we chose in the
@ -126,7 +128,7 @@ BTStack _bt_search(Relation rel, BTScanInsert key, Buffer *bufP, int access, boo
*/
if (needStack) {
new_stack = (BTStack)palloc(sizeof(BTStackData));
new_stack->bts_blkno = BufferGetBlockNumber(*bufP);
new_stack->bts_blkno = par_blkno;
new_stack->bts_offset = offnum;
new_stack->bts_btentry = blkno;
new_stack->bts_parent = stack_in;

View File

@ -81,6 +81,7 @@ BTStack UBTreeSearch(Relation rel, BTScanInsert key, Buffer *bufP, int access, b
ItemId itemid;
IndexTuple itup;
BlockNumber blkno;
BlockNumber par_blkno;
BTStack new_stack = NULL;
/*
@ -111,6 +112,7 @@ BTStack UBTreeSearch(Relation rel, BTScanInsert key, Buffer *bufP, int access, b
itup = (IndexTuple) PageGetItem(page, itemid);
Assert(UBTreeTupleIsPivot(itup) || !key->heapkeyspace);
blkno = UBTreeTupleGetDownLink(itup);
par_blkno = BufferGetBlockNumber(*bufP);
/*
* We need to save the location of the index entry we chose in the
@ -128,7 +130,7 @@ BTStack UBTreeSearch(Relation rel, BTScanInsert key, Buffer *bufP, int access, b
*/
if (needStack) {
new_stack = (BTStack)palloc(sizeof(BTStackData));
new_stack->bts_blkno = BufferGetBlockNumber(*bufP);
new_stack->bts_blkno = par_blkno;
new_stack->bts_offset = offnum;
new_stack->bts_btentry = blkno;
new_stack->bts_parent = stack_in;
@ -1841,4 +1843,4 @@ bool UBTreeGetTupleInternal(IndexScanDesc scan, ScanDirection dir)
} while (so->numArrayKeys && _bt_advance_array_keys(scan, dir));
return res;
}
}