mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Further simplify nbtree high key truncation.
Commit7c2dbc69
reorganized _bt_truncate() in a way that enables a further simplification that I (pgeoghegan) missed: Since we mark the tuple that is returned to the caller as a pivot tuple before the point where its heap TID is set as of7c2dbc69
, it is possible to use the high level BTreeTupleGetHeapTID() inline function to get an item pointer. Do it that way now. This approach is clearer and more maintainable.
This commit is contained in:
@ -2251,6 +2251,7 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright,
|
|||||||
tidpivot->t_info |= newsize;
|
tidpivot->t_info |= newsize;
|
||||||
BTreeTupleSetNAtts(tidpivot, nkeyatts);
|
BTreeTupleSetNAtts(tidpivot, nkeyatts);
|
||||||
BTreeTupleSetAltHeapTID(tidpivot);
|
BTreeTupleSetAltHeapTID(tidpivot);
|
||||||
|
pivotheaptid = BTreeTupleGetHeapTID(tidpivot);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lehman & Yao use lastleft as the leaf high key in all cases, but don't
|
* Lehman & Yao use lastleft as the leaf high key in all cases, but don't
|
||||||
@ -2259,8 +2260,6 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright,
|
|||||||
* TID. (This is also the closest value to negative infinity that's
|
* TID. (This is also the closest value to negative infinity that's
|
||||||
* legally usable.)
|
* legally usable.)
|
||||||
*/
|
*/
|
||||||
pivotheaptid = (ItemPointer) ((char *) tidpivot + newsize -
|
|
||||||
sizeof(ItemPointerData));
|
|
||||||
ItemPointerCopy(BTreeTupleGetMaxHeapTID(lastleft), pivotheaptid);
|
ItemPointerCopy(BTreeTupleGetMaxHeapTID(lastleft), pivotheaptid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user